stringVariation method Null safety

Future<String?> stringVariation(
  1. String flagKey,
  2. String? fallback
)

Returns the flag value for the current user. Returns 'fallback' when one of the following occurs:

  • Flag is missing
  • The flag is not of a string type
  • Any other error flagKey key for the flag to evaluate fallback fallback value in case of errors evaluating the flag

Implementation

Future<String?> stringVariation(String flagKey, String? fallback) async {
  if (fallback == null) {
    return await _channel.invokeMethod(
        'stringVariation', <String, dynamic>{'flagKey': flagKey});
  } else {
    return await _channel.invokeMethod('stringVariationFallback',
        <String, dynamic>{'flagKey': flagKey, 'fallback': fallback});
  }
}