getVariantValue method
- String flagName,
- dynamic fallbackValue
Get just the value of a feature flag.
flagNameThe name of the feature flagfallbackValueA fallback value to use if the flag is not found or not ready
Returns the value of the flag, or the fallback value if not available.
Implementation
Future<dynamic> getVariantValue(String flagName, dynamic fallbackValue) async {
if (!_MixpanelHelper.isValidString(flagName)) {
developer.log('`getVariantValue` failed: flagName cannot be blank',
name: 'Mixpanel');
return fallbackValue;
}
final result = await _channel.invokeMethod<dynamic>('getVariantValue', <String, dynamic>{
'token': _token,
'flagName': flagName,
'fallbackValue': _MixpanelHelper.ensureSerializableValue(fallbackValue),
});
return result ?? fallbackValue;
}