KameleoonClient class abstract

Abstract class KameleoonClient, need use KameleoonClientFactory to create instance

Constructors

KameleoonClient.new()

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(List<Data> data) Future<void>
To associate various data with the current user, we can use the addData() method. This method accepts a list of additional parameters. Those additional parameters represent the various Data Types allowed in Kameleoon. Note that the addData() 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 the flush() 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 of flush.
flush({bool instant = false}) Future<void>
Data associated with the visitor via the addData method is not sent immediately to the server.
getActiveFeatures() Future<Map<String, Variation>>
Retrieves information about active feature flags that are available for a visitor.
getFeatureList() Future<List<String>>
Returns a list of feature flag keys currently available for the sSDK
getFeatureVariable(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 featureKey) Future<String>
Returns a variation key for a visitor
getFeatureVariationVariables(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.
getRemoteData([String key]) Future
The getRemoteData() method allows you to retrieve data (according to a key passed as argument) for specified siteCode (specified in KameleoonClientFactory.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.
getRemoteVisitorData({RemoteVisitorDataFilter filter = const RemoteVisitorDataFilter(), bool addData = true}) Future<List<Data>>
An asynchronous method for retrieving custom data for the latest visit of a visitor from Kameleoon Data API and optionally adding it to the storage so that other methods could decide whether the current visitor is targeted or not.
getVariation(String featureKey, {bool track = true}) Future<Variation>
Retrieves the Variation assigned to a given visitor for a specific feature flag.
getVariations({bool onlyActive = false, bool track = true}) Future<Map<String, Variation>>
Retrieves a map of Variation objects assigned to a given visitor across all feature flags.
getVisitorCode() Future<String>
Returns the unique code associated with a visitor.
getVisitorWarehouseAudience(int customDataIndex, [String? warehouseKey]) Future<CustomData>
Retrieves data associated with a visitor's warehouse audiences and adds it to the visitor.
isFeatureActive(String featureKey, {bool track = true}) Future<bool>
Checks if feature is active for a visitor
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
onUpdateConfiguration(dynamic handler(int)?) → void
If real-time configuration updating is enabled, you can call our SDK's onUpdateConfiguration() method to set the update event handler.
runWhenReady(dynamic callback(bool ready), [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.
setForcedVariation(int experimentId, String? variationKey, {bool forceTargeting = true}) Future<void>
Sets or resets a forced variation for a visitor in a specific experiment.
setLegalConsent(bool consent) Future<void>
Sets or updates the legal consent status for a visitor.
toString() String
A string representation of this object.
inherited
trackConversion(int goalId, [double? revenue, bool negative = false, List<CustomData> metadata = const []]) Future<void>
Tracks a conversion for the specified goal using trackConversion().
trackConversionWithOptParams(int goalId, {double revenue = 0, bool negative = false, List<CustomData> metadata = const []}) Future<void>
Tracks a conversion for the specified goal using trackConversionWithOptParams().

Operators

operator ==(Object other) bool
The equality operator.
inherited