dispose method Null safety

  1. @override
void dispose()
override

dispose should be called when done with the scanner. this will also destroy all hubs attached.

Implementation

@override
void dispose() {
  _hubs.forEach((key, hub) {
    hub.dispose();
  });
  _hubs.clear();

  _subscription?.cancel();
  _subscription = null;
  _controller.close();
}