registerStreamHandler<T extends Object, R> method

void registerStreamHandler<T extends Object, R>(
  1. Stream<R?> select(
    1. T
    ),
  2. void handler(
    1. BuildContext context,
    2. AsyncSnapshot<R?> newValue,
    3. void cancel()
    ), {
  3. R? initialValue,
  4. String? instanceName,
})

registers a handler for a Stream exactly once on the first build and unregisters is when the widget is destroyed. select allows you to register the handler to a member of the of the Object stored in GetIt. If the object itself if the Stream pass (x)=>x here If you pass initialValue your passed handler will be executes immediately with that value All handler get passed in a cancel function that allows to kill the registration from inside the handler.

Implementation

void registerStreamHandler<T extends Object, R>(
  Stream<R?> Function(T) select,
  void Function(BuildContext context, AsyncSnapshot<R?> newValue,
          void Function() cancel)
      handler, {
  R? initialValue,
  String? instanceName,
}) =>
    _state.value.registerStreamHandler<T, R?>(select, handler,
        initialValue: initialValue, instanceName: instanceName);