dispose method

Future<void> dispose()

Cancels the periodic timer and flushes any remaining buffered events.

Should be called when the transport is no longer needed.

Implementation

Future<void> dispose() async {
  _timer?.cancel();
  _timer = null;
  await flush();
}