Last updated:
0 purchases
experiment sdk flutter
Amplitude Experiment implementation for Flutter. This is a non official package provided by ProductMinds.
Features #
fetch: Fetch experiments assigned to user. You can use some properties as below:
variant: Fetch assigned variant for each experiment. You can use some properties as below:
clear: Clear all SDK cache
exposure (works only with initializeWithAmplitude or by providing a custom exposureTrackingProvider): Track exposure for assigned variant in assigned experiment
Getting started #
In order to start using this package you must have properly defined an Amplitude Account and Project as well Amplitude Experiment. When you have already setted your experiment, you should create a deployment and this api key is the artifact that this SDK uses.
The init functions #
initialize: This function is going to return an ExperimentClient instance that you should use to start instrumentation. Look at this:
Experiment.initialize({ required String apiKey, ExperimentConfig? experimentConfig });
copied to clipboard
initializeWithAmplitude: This function is going to return the same ExperimentClient instance configs but will try to link an Amplitude Analytic as exposure tracker.
NOTE: This will work only if you've already installed and setup an analytics plugin
Experiment.initializeWithAmplitude({ required String apiKey, ExperimentConfig? experimentConfig });
copied to clipboard
Config Object
class ExperimentConfig {
final bool? debug;
final String? instanceName;
final ExperimentVariant? fallbackVariant;
final ExperimentVariantSource? source;
final int? fetchTimeoutMillis;
final bool? retryFetchOnFailure;
final bool? automaticExposureTracking;
final ExperimentExposureTrackingProvider? exposureTrackingProvider;
ExperimentConfig(
{this.debug = false,
this.instanceName = 'default-instance',
this.fallbackVariant,
this.source,
this.fetchTimeoutMillis,
this.retryFetchOnFailure,
this.automaticExposureTracking = false,
this.exposureTrackingProvider});
};
copied to clipboard
Usage #
To fetch experiments for user:
Experiment.fetch({ String? userId, String? deviceId, Map<String, dynamic>? userProperties });
copied to clipboard
To get variant for specific experiment:
Experiment.variant(String flagKey);
copied to clipboard
To get all variants and experiments that this user is assigned to:
Experiment.all();
copied to clipboard
To clear all cache data:
Experiment.clear();
copied to clipboard
To track exposure event:
Experiment.exposure(String flagKey);
copied to clipboard
NOTE: works only with initializeWithAmplitude or by providing a custom exposureTrackingProvider
Additional information #
This package is basically an wrappper to Experiment Evaluation API maintened by Product Minds team. If you have any problem with this license or usage, please mail to [email protected].
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.