listen method

StreamSubscription<T> listen(
  1. dynamic callback
)
override

Calls callback whenever there is an event. Returns a StreamSubscription to control the listening.

Implementation

StreamSubscription<T> listen(
    dynamic /* Callback | ValueCallback */ callback) {
  if (callback is Callback) {
    return asStream.listen((_) => callback());
  } else if (callback is ValueCallback<T>) {
    return asStream.listen(callback);
  }
  throw Exception('Invalid callback!');
}