listen method
Notifies listeners of any events taking place inside this bloc. A widget can only call this once.
Similar to addListener, but this one does not need removeListener to be called when the widget is disposed. Instead, this one takes a BuildContext to track listening widget, and removes callback automatically.
Implementation
void listen(BuildContext context, s.BlocListener callback) {
final i = _listeners.indexWhere((e) => e.context == context);
if (i == -1) {
_listeners.add((context: context, callback: callback));
}
}