onInit method
Initialize the network manager and set up a stream to continually check the connection status.
Implementation
@override
void onInit() {
super.onInit();
// Subscribe to the connectivity changes and update the status when it changes.
_connectivitySubscription =
_connectivity.onConnectivityChanged.listen(_updateConnectionStatus);
}