execute method

  1. @override
Future<String?> execute(
  1. BuildContext context
)
override

Implementation

@override
Future<String?> execute(BuildContext context) async {
  if (flagName.isEmpty) {
    return null;
  }

  switch (dataType) {
    case FlagDataType.string:
      return vyuh.featureFlag?.getString(flagName);
    case FlagDataType.number:
      final value = await vyuh.featureFlag?.getInt(flagName);
      return value.toString();
    case FlagDataType.boolean:
      final value = await vyuh.featureFlag?.getBool(flagName);
      return value.toString();
    case FlagDataType.json:
      final value = await vyuh.featureFlag?.getJson(flagName);
      return jsonEncode(value);
  }
}