1717library optimizely_flutter_sdk;
1818
1919import 'dart:async' ;
20+ import 'package:optimizely_flutter_sdk/src/data_objects/activate_response.dart' ;
2021import 'package:optimizely_flutter_sdk/src/data_objects/base_response.dart' ;
2122import 'package:optimizely_flutter_sdk/src/data_objects/datafile_options.dart' ;
2223import 'package:optimizely_flutter_sdk/src/data_objects/event_options.dart' ;
2324import 'package:optimizely_flutter_sdk/src/data_objects/get_forced_decision_response.dart' ;
25+ import 'package:optimizely_flutter_sdk/src/data_objects/get_variation_response.dart' ;
2426import 'package:optimizely_flutter_sdk/src/data_objects/optimizely_config_response.dart' ;
2527import 'package:optimizely_flutter_sdk/src/optimizely_client_wrapper.dart' ;
2628import 'package:optimizely_flutter_sdk/src/user_context/optimizely_user_context.dart' ;
@@ -78,16 +80,14 @@ class OptimizelyFlutterSdk {
7880 /// The activate call will conditionally activate an experiment for a user based on the provided experiment key and a randomized hash of the provided user ID.
7981 /// If the user satisfies audience conditions for the experiment and the experiment is valid and running, the function returns the variation the user is bucketed into.
8082 /// Otherwise, activate returns empty variationKey. Make sure that your code adequately deals with the case when the experiment is not activated (e.g. execute the default variation).
81- Future <GetForcedDecisionResponse > activate (
82- String experimentKey, String userId,
83+ Future <ActivateResponse > activate (String experimentKey, String userId,
8384 [Map <String , dynamic > attributes = const {}]) async {
8485 return await OptimizelyClientWrapper .activate (
8586 _sdkKey, experimentKey, userId, attributes);
8687 }
8788
8889 /// Get variation for experiment and user ID with user attributes.
89- Future <GetForcedDecisionResponse > getVariation (
90- String experimentKey, String userId,
90+ Future <GetVariationResponse > getVariation (String experimentKey, String userId,
9191 [Map <String , dynamic > attributes = const {}]) async {
9292 return await OptimizelyClientWrapper .getVariation (
9393 _sdkKey, experimentKey, userId, attributes);
@@ -112,24 +112,41 @@ class OptimizelyFlutterSdk {
112112 return await OptimizelyClientWrapper .close (_sdkKey);
113113 }
114114
115+ /// Allows user to listen to supported Activate notifications.
116+ Future <CancelListening > addActivateNotificationListener (
117+ ActivateNotificationCallback callback) async {
118+ return await _addActivateNotificationListener (callback);
119+ }
120+
121+ /// Allows user to listen to supported Decision notifications.
115122 Future <CancelListening > addDecisionNotificationListener (
116123 DecisionNotificationCallback callback) async {
117124 return await _addDecisionNotificationListener (callback);
118125 }
119126
127+ /// Allows user to listen to supported Track notifications.
120128 Future <CancelListening > addTrackNotificationListener (
121129 TrackNotificationCallback callback) async {
122130 return await _addTrackNotificationListener (callback);
123131 }
124132
133+ /// Allows user to listen to supported LogEvent notifications.
134+ Future <CancelListening > addLogEventNotificationListener (
135+ LogEventNotificationCallback callback) async {
136+ return await _addLogEventNotificationListener (callback);
137+ }
138+
139+ /// Allows user to listen to supported Project Config Update notifications.
125140 Future <CancelListening > addUpdateConfigNotificationListener (
126141 MultiUseCallback callback) async {
127142 return await _addConfigUpdateNotificationListener (callback);
128143 }
129144
130- Future <CancelListening > addLogEventNotificationListener (
131- LogEventNotificationCallback callback) async {
132- return await _addLogEventNotificationListener (callback);
145+ /// Allows user to listen to supported Activate notifications.
146+ Future <CancelListening > _addActivateNotificationListener (
147+ ActivateNotificationCallback callback) async {
148+ return await OptimizelyClientWrapper .addActivateNotificationListener (
149+ _sdkKey, callback);
133150 }
134151
135152 /// Allows user to listen to supported Decision notifications.
0 commit comments