Closed xxxLucifeRxxx closed 2 years ago
Hi, I'm glad you're using and enjoying the architecture. I had the same need a few days ago and I found the solution with a package
runApp(GetMaterialApp(
onInit: (() {
subscription = Connectivity()
.onConnectivityChanged
.listen((ConnectivityResult result) {
if (result == ConnectivityResult.none) {
Get.to(NotConnectionWidget());
}
});
}),
onDispose: () => subscription.cancel(),
// debugShowMaterialGrid: true,
theme: appTheme,
...
But if you want to do it manually, I still recommend using it from the start of the app, in the main itself. You can organize it better by separating the methods into single files.
Hi, I'm glad you're using and enjoying the architecture. I had the same need a few days ago and I found the solution with a package
runApp(GetMaterialApp( onInit: (() { subscription = Connectivity() .onConnectivityChanged .listen((ConnectivityResult result) { if (result == ConnectivityResult.none) { Get.to(NotConnectionWidget()); } }); }), onDispose: () => subscription.cancel(), // debugShowMaterialGrid: true, theme: appTheme, ...
But if you want to do it manually, I still recommend using it from the start of the app, in the main itself. You can organize it better by separating the methods into single files.
Thank you, this is what I was looking for, I put my code in GetMaterialApp
, and now there is feedback from StreamSubscription
Hi, I follow your architecture and have sorted out all the examples, I really like using it. But I have such a problem, I have a need to monitor the Internet connection during the entire life cycle of the application. And I do not know where I could put the Stream Subscription for this tracking. Since I need to keep track of this constantly, I thought I could do it in my authService extends GetxService, since it is not deleted from memory and lives throughout the entire cycle.
And I would not like to perform this check with every network request I have, I would like to know about the network status always. I tried to do something similar, but I didn't get the desired result:
I could certainly put it in controllers, but I think there will be a lot of boilerplate :)
Could you help me with this, how I could better organize the work of such functionality, I would be very grateful