flag method

Future<FeatureFlag?> flag(
  1. String name, {
  2. bool useResultCache = false,
})

Gets and evaluates a feature flag with the given name. useResultCache determines if the cached result should be used.

Implementation

Future<FeatureFlag?> flag(String name, {bool useResultCache = false}) async {
try {
  var featureFlag = await _module.channel.invokeMethod(
    "featureFlagManager#flag",
    {
      "flagName": name,
      "useResultCache": useResultCache,
    },
  );
  return FeatureFlag._fromJson(featureFlag);
} on PlatformException catch (e) {
  // Catches only PlatformException
  print("Airship feature flag error: $e");
  return null;
} catch (e) {
  // Catches any other exception type
  print("Unexpected error: $e");
  return null;
}
}