unregisterFeatureFlagListener static method Null safety

Future<void> unregisterFeatureFlagListener(
  1. String flagKey,
  2. LDFlagUpdatedCallback flagUpdateCallback
)

Unregisters an LDFlagUpdatedCallback from the flagKey flag.

Implementation

static Future<void> unregisterFeatureFlagListener(String flagKey, LDFlagUpdatedCallback flagUpdateCallback) async {
  _flagUpdateCallbacks.remove(flagKey, flagUpdateCallback);
  if (_flagUpdateCallbacks[flagKey].isEmpty) {
    await _channel.invokeMethod('stopFlagListening', flagKey);
  }
}