getVariantValue method

Future getVariantValue(
  1. String flagName,
  2. dynamic fallbackValue
)

Get just the value of a feature flag.

  • flagName The name of the feature flag
  • fallbackValue A 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;
}