Usage
(first) at your main() Method initialize your Experiment with your apiKey & experimentApp_name try { await Experiment.initializeWithAmplitude( apiKey: "$experimentApiKey", config: ExperimentConfig( debug: false, automaticExposureTracking: true, instanceName: "$experimentApp_name", ), ); } catch (e) {}
(second) get feature flage from these methods
ExperimentClient? _experiment; @override void initState() { _experiment = ExperimentClient(apiKey: AppValues.experimentApiKey); getFeatureFlage() }
void getFeatureFlage() { try { featureFlag().then((varient) async { if (varient?.value == "on") { //here take you action at case on } else { //here take you action at case off } }); } catch (e) {} }
Future<ExperimentVariant?> featureFlag() async { ExperimentVariant? variant;
try {
await _experiment?.fetch(userId: "userId").then((_) {
variant = _experiment?.variant(AppValues.mazadFeatureFlage);
});
} catch (e) {
variant = null;
}
return variant;
}
Libraries
- experiment_client
- experiment_sdk_flutter
- feature_flage_amplitude
- http_client
- integrations/experiment_analytics
- local_storage
- types/experiment_config
- types/experiment_expose_tracking_context
- types/experiment_exposure_tracking_provider
- types/experiment_fetch_input
- types/experiment_fetch_item
- types/experiment_sources
- types/experiment_variant