Skip to content

pedrolemoz-cloudwalk/experiment_sdk_flutter

 
 

Repository files navigation

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 });

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 });

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});
};

Usage

To fetch experiments for user:

Experiment.fetch({ String? userId, String? deviceId, Map<String, dynamic>? userProperties });

To get variant for specific experiment:

Experiment.variant(String flagKey);

To get all variants and experiments that this user is assigned to:

Experiment.all();

To clear all cache data:

Experiment.clear();

To track exposure event:

Experiment.exposure(String flagKey);

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].

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Dart 84.4%
  • HTML 7.6%
  • Ruby 5.6%
  • Swift 1.7%
  • Other 0.7%