onClose method
Dispose or close the active connectivity stream when the controller is closed.
Implementation
@override
void onClose() {
super.onClose();
// Cancel the subscription to prevent memory leaks.
_connectivitySubscription.cancel();
}