On the new version the listener takes List of ConnectivityResult. Hence, now the method should be like this- void _updateConnectionStatus(List connectivityResult) { if (connectivityResult.contains(ConnectivityResult.none)) { Get.rawSnackbar( messageText: Text('Connect to the internet'), isDismissible: false, duration: Duration(days: 1), ); } else { if (Get.isSnackbarOpen) { Get.closeCurrentSnackbar(); } } }
@bimajatikusuma749329 күн бұрын
thank you buddy,
@SaurabhJain-m8d Жыл бұрын
Straightforward video, thank you! for this, however, I am facing a problem, when my internet connection is off and I open the app, I don't see the snack bar? Could you please help me to show the snack bar, when the internet connection is already off?
@_ritesh30511 ай бұрын
@override void onInit() { super.onInit(); _checkInitialConnectionStatus(); _connectivity.onConnectivityChanged.listen(_updateConnectionStatus); } void _checkInitialConnectionStatus() async { ConnectivityResult connectivityResult = await _connectivity.checkConnectivity(); _updateConnectionStatus(connectivityResult); } modify your NetworkController class like this and instead of calling the DependencyInjection.init(); inside the main function use it inside the initState of the child of the runApp();
@rutujamogal75642 ай бұрын
i am getting also same error do you found any solution if yes then please tell me
@aggaditya6 ай бұрын
if someone is struggling to display snackbar, the part where you write the snackbar code to display "No Internet", also add the same ssnackbar in else condition ( change the text to "internet found ")inside the if block, this worked for me!
@MrAmrmnabil746 ай бұрын
why this error "The argument type 'void Function(ConnectivityResult)' can't be assigned to the parameter type 'void Function(List)?'"
@aggaditya6 ай бұрын
@@MrAmrmnabil74 i think one parameter is missing
@MrAmrmnabil746 ай бұрын
@@aggaditya does this code worked with you ?
@aggaditya6 ай бұрын
@@MrAmrmnabil74 yes it works, but sometimes its buggy. Will find better solution later but works for now
@faithtutsacademy7 Жыл бұрын
Simple and to the point. Thanks
@None-vj7vuАй бұрын
thanks bro, that was really userful
@talhasezer4 Жыл бұрын
This feature is really cool and easy to understand thanks to you. You got a new subscriber my friend.
@flutterguys Жыл бұрын
❤✌
@mrHachem Жыл бұрын
thank you a lot you saved me a week of work take my subscribtion
@flutterguys Жыл бұрын
❤✌
@tanvirul-swe Жыл бұрын
Exactly you hit the pick point thanks ❤
@flutterguys Жыл бұрын
❤✌
@JubayerAl-k6c Жыл бұрын
This is really great, Kindly make video on Provider & RiverPod too!
@flutterguys Жыл бұрын
Noted
@Hazara_boy Жыл бұрын
Your videos are pure gold.
@flutterguys Жыл бұрын
Thank you
@kaustubhbavane-oq3nb4 ай бұрын
The argument type 'void Function(ConnectivityResult)' can't be assigned to the parameter type 'void Function(List)?'
@munimlabib96692 ай бұрын
got the same error...you found any solution bro?
@ArtVandelayIncАй бұрын
ConnectivityResult is a list now not a single value. You gotta adjust your code checking the list if it contains a specific ConnectivityResult like ConnectivityResult.wifi and so on. There is a code sample on the package's page just showing that. Hope this helps
@lukamandic96946 ай бұрын
This is great, but I have a question. Why it does not work when you try to start the app while not connected to the net? Can we make it work in that case too? Thanks
@flutterguys6 ай бұрын
Yes you can , please make it so I will merge it
@HelaFARHATI9 ай бұрын
hello , thanks a lot for this explanation , i just want to ask if I'm already using bloc for state management is it okay to implement this code , or is there anyway I can do it using bloc? thanks in advance
@flutterguys9 ай бұрын
Yes, you can
@morrigan_ghost Жыл бұрын
great tutorial. Btw as i heard many of flutter devs don't like getx
@flutterguys Жыл бұрын
Yes, if you build your app based on Getx, it is very wrong, but in some cases it is not a problem to use it.
@iigama_yt3016 Жыл бұрын
@@flutterguyscan you tell us why ?
@huyhoangvu3428 Жыл бұрын
@@iigama_yt3016 actually, getx it self has many bugs
@mrfounderrАй бұрын
I have done all the steps exactly according to the tutorial but it still don't show snackbar. I don't get an error when I turn off wifi but when I turn it back on, I get a late initialization error saying that controller is not initialized.
@specksdude Жыл бұрын
Bro you saved my whole day
@KnightlyJones2 ай бұрын
its really useful buddy
@bimajatikusuma749329 күн бұрын
thank you, legend
@youssefchaoulid19892 ай бұрын
Tnx nice tuto 🎉❤
@thenightguy6816 Жыл бұрын
Can we do this using get_it package if so how would you approach this using get_it and connectivity_plus.
@ManpreetSingh-hq3dw6 ай бұрын
When i pass _udateconnectivityresult in listen then its showing error iff anybody know plz let me know
@SMAppshub Жыл бұрын
It's Working .Thank You So much. But it is not working at the beginning ,i mean if user Connection turn off and user open the app, it's not working, it is only working in inside the app Connection turn off and turn on . how can we make it work in the beginning.
@flutterguys Жыл бұрын
Usually, in applications, when the user is not connected to the Internet and opens the application, we check separately on the splash page and give a warning.
@BJKarlGeronimo Жыл бұрын
This will show on top of bottom navigation bar as well. How do we handle this if screen has bottom navigation or not?
@flutterguys Жыл бұрын
I think you can't handle it , But please check Snackbar properties.
@nipunshah1373 Жыл бұрын
Can you create a video depicting flutter project with GetX + Clean Archi + DI, with standard guidelines ??
@flutterguys Жыл бұрын
Yes, it is in our plan.
@muhammadhilmiizzulhaq4375 Жыл бұрын
This is great! but I encountered a situation where the device starts in an offline state, the snackbar doesn't appear, how do I set it up for the snackbar to appear?
@flutterguys Жыл бұрын
I have to fix it but I don't have time unfortunately. If you can fix it, and make a merge request on GitHub and I will merge.
@muhammadhilmiizzulhaq4375 Жыл бұрын
@@flutterguys Hahaha, I mean, I'm a beginner and I'm confused to fix it.
@fadij.87608 ай бұрын
I don't know if you still need this but here is the solution anyways lol. the logic to show the snackbar when the device goes offline, but it likely won't trigger if the initial state is offline because the listener in _updateConnectionStatus starts listening after initialization. replace oninit() methode in the networkcontroller with this methode and that should do it: void onInit() { super.onInit(); _connectivity.checkConnectivity().then((result) { _updateConnectionStatus(result); }); _connectivity.onConnectivityChanged.listen(_updateConnectionStatus); }
@dave85187 ай бұрын
@@fadij.8760 thanks bro ❤
@ylmazyagzdokumac1662 Жыл бұрын
First of all, thank you for the video, I did exactly what you did. But when I turn the internet back on, first it works properly, the snackbar goes away, then the snackbar comes back even though there is internet, as if there is no internet. Do you have any suggestions?
@flutterguys Жыл бұрын
Please check source code
@ylmazyagzdokumac1662 Жыл бұрын
@@flutterguys I went through all your code and used it exactly. The situation I said is not resolved. Solved when using internet connection checker instead of Connectivity Plus.
@wadialyaqut35699 ай бұрын
thank you.
@chrisillafernanda20659 ай бұрын
is it still working if i navigate to many page?? and is it still working for the notification if i change to new page not using snackbar ?? is it stilll real time?? thank you
@flutterguys9 ай бұрын
Yes
@tanvirul-swe Жыл бұрын
How can I do the same thing using bloc? Please explain
@flutterguys Жыл бұрын
You can use global navigator key. And inside bloc constructor, start listening to connectivity stream. As connectivity change, show snack bar or toast and use context of global navigator key. Use google to find how to use global navigator key.
@tanvirul-swe Жыл бұрын
@@flutterguys thanks 👍
@kurdev1019 ай бұрын
Keep going, thanks a lot . ❤
@anassa67377 ай бұрын
how you pass a paremeter on void and not out it where you call it its make on m code??
@Ayan-od8hk5 ай бұрын
The only problem is that it only shows, if device is connected to network, not whether there is active internet
@adnannaatsofficial3728 Жыл бұрын
sir you have added files insidr main but i have main file at home to plash screen and then other screens respectively so how i can access this network controller to all the othr screns as well need urgent response thanks
@flutterguys Жыл бұрын
You need use GetMaterialApp insted of MaterialApp
@adnannaatsofficial3728 Жыл бұрын
@@flutterguys I have use the same code you do ditto copy but still when I use screen on main as you do then also snack bar not showing at all
@adnannaatsofficial3728 Жыл бұрын
@@flutterguys done actually network injection file was inside controllers folder tahtswhy not showing
@uditrajmr3 Жыл бұрын
i use mobx, how do i do it?
@nashwan882911 ай бұрын
I want to get internal and external ip adrees and nrtworktype using flutter please
@jeetchheda36756 ай бұрын
is it possible to show a widget popup instead of a Snackbar ?
@flutterguys6 ай бұрын
Yes
@gauravkushwaha72074 ай бұрын
How can I give some idea hints to implement that ??@@flutterguys
@thuanphamvan6210 Жыл бұрын
Hi, How can I refresh the current page after reconnecting to the network, please?
@ahmadyusuf.2Ай бұрын
Pls did you eventually know how?
@malikkahfi2292 Жыл бұрын
Thanks
@tif73058 ай бұрын
beautiful
@tomjerry-g2u Жыл бұрын
hey I'm waiting for your clean architecture project with firebase ? could you give us that MVVM complete project in this month?
@flutterguys Жыл бұрын
Soon
@roponpov11 ай бұрын
how to using this with provider ?
@manishadharmik5240 Жыл бұрын
how to make this with bloc
@faheemahmadofficial77018 ай бұрын
is thia depenxcy injecTion?
@flutterguys8 ай бұрын
Yes
@abishekab213 ай бұрын
Giving an error in the lime that's supposed to listen
@Omesh7 Жыл бұрын
I want the Same using flutter riverpod
@SuddenlyAPotatoAppears6 ай бұрын
The video would be perfect if it stil worked correctly
@ABHISHEKSHARMA-uj7jf2 ай бұрын
best best
@SelfTalk0 Жыл бұрын
Thank You so much ! It's exactly what i was looking for ! But, looking at your videos, something cames to my mind. Can we do the with something else than Getx ? I'm a Junior developer learning flutter and getx, but on the internet , there is too much polymic about getX, so i don't really know if i made a good choice. Or should i move to something else ? 😅 Once again : Thank you so much for your sharing such a golden tips ! ❤🔥
@flutterguys Жыл бұрын
Thank you for your support ❤ Yes you can use other state managements like Bloc or Riverpod ... getx is really useful, but on the condition that you only use it in certain situations, like in this video. And it is better to use bloc or riverpod to manage the state.
@kaustubhbavane-oq3nb4 ай бұрын
The argument type 'void Function(ConnectivityResult)' can't be assigned to the parameter type 'void Function(List)?'
@edvinrushitaj4 ай бұрын
You should modify it like this: void _updateConnectionStatus(List connectivityResult) { if (connectivityResult.contains(ConnectivityResult.none)) { Get.rawSnackbar( messageText: const Text('No internet connection')...... etc