@@ -79,111 +79,170 @@ class OptimizelyFlutterSdk {
7979 /// 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.
8080 /// 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.
8181 /// 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).
82+ ///
83+ /// Takes [experimentKey] The key of the experiment to set with the forced variation.
84+ /// Takes [userId] The ID of the user to force into the variation.
85+ /// Takes [attributes] A [Map] of custom key-value string pairs specifying attributes for the user.
86+ /// Returns [ActivateResponse] The key of the variation where the user is bucketed, or `empty variationKey` if the user
87+ /// doesn't qualify for the experiment.
8288 Future <ActivateResponse > activate (String experimentKey, String userId,
8389 [Map <String , dynamic > attributes = const {}]) async {
8490 return await OptimizelyClientWrapper .activate (
8591 _sdkKey, experimentKey, userId, attributes);
8692 }
8793
8894 /// Get variation for experiment and user ID with user attributes.
95+ ///
96+ /// Takes [experimentKey] The key of the experiment to set with the forced variation.
97+ /// Takes [userId] The ID of the user to force into the variation.
98+ /// Takes [attributes] A [Map] of custom key-value string pairs specifying attributes for the user.
99+ /// Returns [GetVariationResponse] The key of the variation where the user is bucketed, or `empty variationKey` if the user
100+ /// doesn't qualify for the experiment.
89101 Future <GetVariationResponse > getVariation (String experimentKey, String userId,
90102 [Map <String , dynamic > attributes = const {}]) async {
91103 return await OptimizelyClientWrapper .getVariation (
92104 _sdkKey, experimentKey, userId, attributes);
93105 }
94106
95107 /// Get forced variation for experiment and user ID.
108+ ///
109+ /// Takes [experimentKey] The key of the experiment to set with the forced variation.
110+ /// Takes [userId] The ID of the user to force into the variation.
111+ /// Returns [GetVariationResponse] The key of the variation where the user is bucketed, or `empty variationKey` if the user
112+ /// doesn't qualify for the experiment.
96113 Future <GetVariationResponse > getForcedVariation (
97114 String experimentKey, String userId) async {
98115 return await OptimizelyClientWrapper .getForcedVariation (
99116 _sdkKey, experimentKey, userId);
100117 }
101118
102119 /// Set forced variation for experiment and user ID to variationKey.
120+ ///
121+ /// Takes [experimentKey] The key of the experiment to set with the forced variation.
122+ /// Takes [userId] The ID of the user to force into the variation.
123+ /// Takes [variationKey] The key of the forced variation.
124+ /// Returns [BaseResponse] success as `true` if the user was successfully forced into a variation, `false` if the `experimentKey`
125+ /// isn't in the project file or the `variationKey` isn't in the experiment.
103126 Future <BaseResponse > setForcedVariation (String experimentKey, String userId,
104127 [String variationKey = "" ]) async {
105128 return await OptimizelyClientWrapper .setForcedVariation (
106129 _sdkKey, experimentKey, userId, variationKey);
107130 }
108131
109- /// Returns a snapshot of the current project configuration.
132+ /// Returns [OptimizelyConfigResponse] a snapshot of the current project configuration.
110133 Future <OptimizelyConfigResponse > getOptimizelyConfig () async {
111134 return await OptimizelyClientWrapper .getOptimizelyConfig (_sdkKey);
112135 }
113136
114137 /// Creates a context of the user for which decision APIs will be called.
115138 ///
116- /// A user context will only be created successfully when the SDK is fully configured using initializeClient.
139+ /// NOTE: A user context will only be created successfully when the SDK is fully configured using initializeClient.
140+ ///
141+ /// Takes [userId] the [String] user ID to be used for bucketing.
142+ /// Takes [attributes] An Optional [Map] of attribute names to current user attribute values.
143+ /// Returns An [OptimizelyUserContext] associated with this OptimizelyClient.
117144 Future <OptimizelyUserContext ?> createUserContext (String userId,
118145 [Map <String , dynamic > attributes = const {}]) async {
119146 return await OptimizelyClientWrapper .createUserContext (
120147 _sdkKey, userId, attributes);
121148 }
122149
123150 /// Checks if eventHandler are Closeable and calls close on them.
151+ ///
152+ /// Returns [BaseResponse] A object containing success result or reason of failure.
124153 Future <BaseResponse > close () async {
125154 return await OptimizelyClientWrapper .close (_sdkKey);
126155 }
127156
128157 /// Allows user to listen to supported Activate notifications.
158+ ///
159+ /// Takes [callback] A [ActivateNotificationCallback] notification handler to be added.
160+ /// Returns [CancelListening] A callback function that allows the user to remove the added notification listener.
129161 Future <CancelListening > addActivateNotificationListener (
130162 ActivateNotificationCallback callback) async {
131163 return await _addActivateNotificationListener (callback);
132164 }
133165
134166 /// Allows user to listen to supported Decision notifications.
167+ ///
168+ /// Takes [callback] A [DecisionNotificationCallback] notification handler to be added.
169+ /// Returns [CancelListening] A callback function that allows the user to remove the added notification listener.
135170 Future <CancelListening > addDecisionNotificationListener (
136171 DecisionNotificationCallback callback) async {
137172 return await _addDecisionNotificationListener (callback);
138173 }
139174
140175 /// Allows user to listen to supported Track notifications.
176+ ///
177+ /// Takes [callback] A [TrackNotificationCallback] notification handler to be added.
178+ /// Returns [CancelListening] A callback function that allows the user to remove the added notification listener.
141179 Future <CancelListening > addTrackNotificationListener (
142180 TrackNotificationCallback callback) async {
143181 return await _addTrackNotificationListener (callback);
144182 }
145183
146184 /// Allows user to listen to supported LogEvent notifications.
185+ ///
186+ /// Takes [callback] A [LogEventNotificationCallback] notification handler to be added.
187+ /// Returns [CancelListening] A callback function that allows the user to remove the added notification listener.
147188 Future <CancelListening > addLogEventNotificationListener (
148189 LogEventNotificationCallback callback) async {
149190 return await _addLogEventNotificationListener (callback);
150191 }
151192
152193 /// Allows user to listen to supported Project Config Update notifications.
194+ ///
195+ /// Takes [callback] A [MultiUseCallback] notification handler to be added.
196+ /// Returns [CancelListening] A callback function that allows the user to remove the added notification listener.
153197 Future <CancelListening > addUpdateConfigNotificationListener (
154198 MultiUseCallback callback) async {
155199 return await _addConfigUpdateNotificationListener (callback);
156200 }
157201
158202 /// Allows user to listen to supported Activate notifications.
203+ ///
204+ /// Takes [callback] A [ActivateNotificationCallback] notification handler to be added.
205+ /// Returns [CancelListening] A callback function that allows the user to remove the added notification listener.
159206 Future <CancelListening > _addActivateNotificationListener (
160207 ActivateNotificationCallback callback) async {
161208 return await OptimizelyClientWrapper .addActivateNotificationListener (
162209 _sdkKey, callback);
163210 }
164211
165212 /// Allows user to listen to supported Decision notifications.
213+ ///
214+ /// Takes [callback] A [DecisionNotificationCallback] notification handler to be added.
215+ /// Returns [CancelListening] A callback function that allows the user to remove the added notification listener.
166216 Future <CancelListening > _addDecisionNotificationListener (
167217 DecisionNotificationCallback callback) async {
168218 return await OptimizelyClientWrapper .addDecisionNotificationListener (
169219 _sdkKey, callback);
170220 }
171221
172222 /// Allows user to listen to supported Track notifications.
223+ ///
224+ /// Takes [callback] A [TrackNotificationCallback] notification handler to be added.
225+ /// Returns [CancelListening] A callback function that allows the user to remove the added notification listener.
173226 Future <CancelListening > _addTrackNotificationListener (
174227 TrackNotificationCallback callback) async {
175228 return await OptimizelyClientWrapper .addTrackNotificationListener (
176229 _sdkKey, callback);
177230 }
178231
179232 /// Allows user to listen to supported LogEvent notifications.
233+ ///
234+ /// Takes [callback] A [LogEventNotificationCallback] notification handler to be added.
235+ /// Returns [CancelListening] A callback function that allows the user to remove the added notification listener.
180236 Future <CancelListening > _addLogEventNotificationListener (
181237 LogEventNotificationCallback callback) async {
182238 return await OptimizelyClientWrapper .addLogEventNotificationListener (
183239 _sdkKey, callback);
184240 }
185241
186242 /// Allows user to listen to supported Project Config Update notifications.
243+ ///
244+ /// Takes [callback] A [MultiUseCallback] notification handler to be added.
245+ /// Returns [CancelListening] A callback function that allows the user to remove the added notification listener.
187246 Future <CancelListening > _addConfigUpdateNotificationListener (
188247 MultiUseCallback callback) async {
189248 return await OptimizelyClientWrapper .addConfigUpdateNotificationListener (
0 commit comments