KameleoonClient class abstract
Abstract class KameleoonClient, need use KameleoonClientFactory to create instance
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
addData(
String visitorCode, List< Data> data) → Future<void> -
To associate various data with the current user, we can use the
addData()
method. This method requires thevisitorCode
as a first parameter, and then accept a list of additional parameters. Those additional parameters represent the various Data Types allowed in Kameleoon. Note that theaddData()
method doesn't return any value and doesn't interact with the Kameleoon back-end servers by itself. Instead, every data declared is saved for further sending via theflush()
method. This allows a minimal number of server calls to be made, as data are usually regrouped in a single server call triggered by the execution offlush()
. -
flush(
[String? visitorCode]) → Future< void> -
Data associated with the current user via
addData()
method is not sent immediately to the server. It is stored and accumulated until it is sent automatically by thetriggerExperiment()
,trackConversion()
getFeatureVariationKey()
,getFeatureVariable
orisFeatureActive
methods, or manually by theflush()
method. This allows the developer to exactly control when the data is flushed to our servers. For instance, if you call theaddData()
method a dozen times, it would be a waste of resources to send data to the server after eachaddData()
invocation. Just callflush()
once at the end. Theflush()
method doesn't return any value. This method is non-blocking as the server call is made asynchronously. -
getExperimentList(
[String visitorCode, bool onlyAllocated]) → Future< List< int> > - Retrieves a list of experiment IDs for either all existing experiments (if no visitor code is provided) or specifically targeted or active experiments that are currently active for a given visitor.
-
getFeatureAllVariables(
String featureKey, String variationKey) → Future< Map< String, dynamic> > - Retrieves all feature variables for specific variation key. A feature variable can be changed easily via our web application.
-
getFeatureList(
) → Future< List< String> > - Returns a list of feature flag keys currently available for the sSDK
-
getFeatureListActive(
String visitorCode) → Future< List< String> > - Returns a list of function flag keys that are active for a given visitor
-
getFeatureVariable(
String visitorCode, String featureKey, String variableKey) → Future - Retrieves a feature variable value from assigned for a visitor variation A feature variable can be changed easily via our web application.
-
getFeatureVariationKey(
String visitorCode, String featureKey) → Future< String> - Returns a variation key for a given visitor code
-
getRemoteData(
String key) → Future -
The
getRemoteData()
method allows you to retrieve data (according to a key passed as argument) for specified siteCode (specified inKameleoonClientFactory.create()
) stored on a remote Kameleoon server. Usually data will be stored on our remote servers via the use of our Data API. This method, along with the availability of our highly scalable servers for this purpose, provides a convenient way to quickly store massive amounts of data that can be later retrieved for each of your visitors / users. Note that since a server call is required, this mechanism is asynchronous. -
getVariationAssociatedData(
int variationId) → Future - To retrieve JSON data associated with a variation, call the getVariationAssociatedData() method of our SDK.
-
getVisitorCode(
{String? domain, String? defaultVisitorCode}) → Future< String> -
isFeatureActive(
String visitorCode, String featureKey) → Future< bool> - Checks if feature is active for a given visitor code
-
isReady(
) → bool? - For mobile SDKs, the initialization of the Kameleoon Client is not immediate, as it needs to perform a server call to retrieve the current configuration for all active experiments. It is recommended to check if the SDK is ready by calling this method before triggering an experiment. Alternatively, you could setup exception catching around the triggerExperiment() method to look for the KameleoonException.SDKNotReady exception, or you could use the runWhenReady() method with a callback as detailed in the next paragraph.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
obtainFeatureVariable(
dynamic featureKeyOrID, String variableKey) → Future -
To retrieve a feature variable, call the
obtainFeatureVariable()
method of our SDK. A feature variable can be changed easily via our web application. This method takes two input parameters:featureKey
andvariableKey
. It will return the data as anObject
instance. Usually it should be casted to the expected type (the one defined on the web interface). It will throw an exceptionKameleoonException.FeatureNotFound
if the requested feature has not been found in the internal configuration of the SDK. -
obtainVariationAssociatedData(
int variationId) → Future -
obtainVisitorCode(
[String? defaultVisitorCode]) → Future< String?> -
retrieveDataFromRemoteSource(
String key) → Future -
runWhenReady(
Function readyCallback, Function failCallback, [Duration? timeout]) → void -
For mobile SDKs, the initialization of the Kameleoon Client is not immediate, as it needs to perform a
server call to retrieve the current configuration for all active experiments. The
runWhenReady()
method of the KameleoonClient class allows to pass a callback that will be executed as soon as the SDK is ready for use. It also allows the use of a timeout. The first callback will be executed once the Kameleoon client is ready, and should contain code triggering an experiment and implementing variations. The second callback will be executed if the specified timeout happens before the client is initialized. Usually this case should implement the "reference" variation, as the user will be "out of the experiment" if a timeout takes place. -
toString(
) → String -
A string representation of this object.
inherited
-
trackConversion(
String visitorCode, int goalID, [double? revenue]) → Future< void> -
To track conversion, use the
trackConversion()
method. This method requires visitorCode and goalId to track conversion on this particular goal. In addition, this method also accepts revenue as a third optional argument to track revenue. The visitorCode should be identical to the one that was used when triggering the experiment. ThetrackConversion()
method doesn't return any value. This method is non-blocking as the server call is made asynchronously. -
triggerExperiment(
String visitorCode, int experimentID) → Future< int> -
Running an A/B experiment on your Flutter application means bucketing your users into several
groups (one per variation). The SDK takes care of this bucketing (and the associated reporting) automatically.
Triggering an experiment by calling the
triggerExperiment()
method will register a random variation for a given visitorCode. If this visitorCode is already associated with a variation (most likely the user had already been exposed to the experiment previously), then it will return the previous variation associated with a given experiment. -
updateConfigurationHandler(
Function handler) → void -
If real-time configuration updating is enabled, you can call our SDK's
updateConfigurationHandler()
method to set the update event handler. This method takes one input parameter:handler
The handler is a closure that will be called when the configuration is updated using a real-time configuration event.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited