listen method

MiniSubscription<T> listen(
  1. void onData(
    1. T event
    ), {
  2. Function? onError,
  3. void onDone()?,
  4. bool cancelOnError = false,
})

Implementation

MiniSubscription<T> listen(void Function(T event) onData,
    {Function? onError,
    void Function()? onDone,
    bool cancelOnError = false}) {
  final subs = MiniSubscription<T>(
    onData,
    onError,
    onDone,
    cancelOnError,
    listenable,
  );
  listenable.addListener(subs);
  return subs;
}