subscribeToFeatureFlags method

StreamSubscription subscribeToFeatureFlags(
  1. void onEvent(
    1. List<BrazeFeatureFlag>
    )
)

Subscribes to the stream of feature flags and calls onEvent when it receives the list of feature flags.

Implementation

StreamSubscription subscribeToFeatureFlags(
    void Function(List<BrazeFeatureFlag>) onEvent) {
  StreamSubscription subscription =
      featureFlagsStreamController.stream.listen(onEvent);

  // Give any existing feature flags
  getAllFeatureFlags().then((ffs) => onEvent(ffs));

  return subscription;
}