registerAllFlagsListener method Null safety

Future<bool?> registerAllFlagsListener(
  1. String? listenerId,
  2. void callback(
    1. List<String>
    )?
)

Registers a callback to be called when a flag update is processed by the SDK.

listenerId the id to attach the listener to callback the listener to attach to the listenerId

Implementation

Future<bool?> registerAllFlagsListener(
    String? listenerId, void Function(List<String>)? callback) async {
  if (listenerId == null || callback == null) {
    return false;
  }

  if (allFlagsListeners!.containsKey(listenerId)) {
    allFlagsListeners![listenerId] = callback;
    return true;
  }

  allFlagsListeners![listenerId] = callback;
  return await _channel.invokeMethod('registerAllFlagsListener',
      <String, dynamic>{'listenerId': listenerId});
}