unregisterFeatureFlagListener method Null safety

Future<bool?> unregisterFeatureFlagListener(
  1. String? flagKey
)

Unregisters the existing callback for the flagKey.

flagKey the flag key to remove the listener from

Implementation

Future<bool?> unregisterFeatureFlagListener(String? flagKey) async {
  if (flagKey == null) {
    return false;
  }

  if (!flagListeners!.containsKey(flagKey) ||
      flagListeners![flagKey] == null) {
    return false;
  }

  flagListeners!.remove(flagKey);
  return await _channel.invokeMethod(
      'unregisterFeatureFlagListener', <String, dynamic>{'flagKey': flagKey});
}