feature_flage_amplitude 0.0.1
feature_flage_amplitude: ^0.0.1 copied to clipboard
a feature flage for Amplitude
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;
}