onDisconnect method

  1. @override
Future<void> onDisconnect()

Sends a Disconnect message to the dashboard and sets destination to null.

Override this function to run custom code when the dashboard disconnects, but be sure to call super.onDisconnect() as well. For example, put code to stop the rover from driving in here to prevent it from crashing when connection is lost.

Implementation

@override
Future<void> onDisconnect() async {
  await collection.orchestrator.abort();
  super.onDisconnect();
}