Connectivity (Flutter Package of the Week)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[MUSIC PLAYING] SPEAKER: When using a mobile phone, things usually just work. Open a browser, and the internet loads. Open an app, and photos of Dash load. But as a developer, how do you know ahead of time if those network requests will work? The connectivity package can help with this. At its core, it tells you if the device is connected to a Wi-Fi network, a cell network, or nothing at all. There are two ways to use this API. The first is to immediately get the connection status. Start with constructing a new connectivity object and await for checkConnectivity. The result will be one of three things for what kind of network is likely to be used-- Wi-Fi, mobile, or nothing at all. checkConnectivity is an interface around platform-specific code that checks the state of the connectivity for each specific platform. And depending on how users use their platform, the connectivity might change. Enter the second way to check connectivity. Once you have a connectivity object, use onConnectivityChanged to register a listener callback. This gives you a subscription to a stream that you can use to update the status as it changes. The result will be one of the same three options as before. And that's it. With this newfound knowledge, you'll be able to know what kind of internet connection is available for your app. For more info on connectivity and all the other packages, head on over to pub.dev.
Info
Channel: Flutter
Views: 99,690
Rating: undefined out of 5
Keywords: connectivity, Flutter connectivity, connectivity package, Flutter packages, flutter connectivity tutorial, flutter connect to wifi, How to check internet connection continuously in Flutter, build an app, app building, coding, widgets, create a widget, widgets for your app, coding an app, Flutter, widget of the week, google, google developers, flutter 101, get started with flutter, flutter apps, flutter widgets, build apps with flutter, Package of the Week, GDS: Yes
Id: P2vaBZDSqzg
Channel Id: undefined
Length: 1min 42sec (102 seconds)
Published: Thu May 06 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.