registerFeatureFlagListener static method Null safety

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

Registers a callback to be notified when the value of the flag flagKey is updated.

Implementation

static Future<void> registerFeatureFlagListener(String flagKey, LDFlagUpdatedCallback flagUpdateCallback) async {
  var isOnlyListenerForFlag = _flagUpdateCallbacks[flagKey].isEmpty;
  _flagUpdateCallbacks.add(flagKey, flagUpdateCallback);
  if (isOnlyListenerForFlag) {
    await _channel.invokeMethod('startFlagListening', flagKey);
  }
}