onclose abstract method
Registers a handler that will be invoked when the connection is closed.
callback
The handler that will be invoked when the connection is closed. Optionally receives a single argument containing the error that caused the connection to close (if any).
Implementation
void onclose(void Function(Object? error) callback);