internet_state_manager 1.9.0
internet_state_manager: ^1.9.0 copied to clipboard
A Flutter package for seamless internet connection management. Automatically detect connectivity changes, handle outages with customizable widgets, and execute logic when the connection is restored—al [...]
Changelog #
1.9.0 #
Enhanced
-
Introduced a new
initialize()method inInternetStateManagerInitializerthat performs a local network connectivity check before the app starts.
This ensures that the internet state is correctly initialized and available from the first frame of the app. -
Improved
NoInternetBottomWidgetUI by adding bottom padding as a Safe area, ensuring it displays correctly above system UI. -
Added a ready-to-use
NoInternetScreenwidget that automatically checks internet connectivity at intervals defined bycheckConnectionPeriodicinInternetStateOptions(default:Duration(seconds: 12)). This periodic check runs only ifautoCheckConnectionis set totrue(default).
Updated Initialization Example:
void main() async {
WidgetsFlutterBinding.ensureInitialized();
// ✅ Required: Initializes internet connection check before app runs
await InternetStateManagerInitializer.initialize();
runApp(
InternetStateManagerInitializer(
child: MyApp(),
),
);
}
New Usage
-
Using
InternetStateManagerwithoutbuilderwill automatically display NoInternetBottomWidget at the bottom of the screen when the internet is disconnected. -
For full-screen custom handling, use
InternetStateManager.builderto render your own widget, or provideNoInternetScreentoInternetStateManagerlike this:InternetStateManager( noInternetScreen: NoInternetScreen(), // Shows this screen when offline, or pass your custom screen. child: // Your screen here, );
1.7.1 #
Fix
- Removed the
internet_connection_checkerpackage, as recent versions were removed from pub.flutter-io.cn due to licensing issues. - Replaced
internet_connection_checkerwithinternet_connection_checker_pluspackage to ensure continued functionality and compliance.
1.7.0 #
Added
checkConnectionTimeoutoption to set the timeout duration when checking real internet connection.
1.6.1 #
Added
- Change
checkConnectionreturn type toFuture<bool>to return if connection is available or not.
1.5.0 #
Enhanced
- Recheck the connection if
autoCheckConnectionis TRUE or if connection lost.
1.4.2 #
Fixed
- internet_connection_checker version, set to any
1.4.1 #
Added
internetCheck()context extension to allow to check internet form context extension.
1.3.1 #
Added
internetStateStreamaccessed fromcontextto listen for internet connection changes only (* without listening to loading states*), i.e:context.internetStateStream.listen((status){}).
Fixed
- ios 12+ known issue with
ConnectivityPlusthat get none even if the local network is available, the bloc is now check the real internet connection onioseven if the local network is none.
1.2.0 #
Enhancements
- Optimized the emission of the loading state to occur only when disconnected and a local network (e.g., Wi-Fi) is available, reducing unnecessary state emissions.
- Improved overall efficiency by decreasing the emission of unnecessary states, avoiding the loading state in cases where it isn't required.
Added
showLogsoption to enable or disable log prints, providing better control over console output.disconnectionCheckPeriodicoption to set theDurationfor periodic checks during a disconnection state, allowing more granular control over connectivity checks.
Updated
- Example project to reflect the latest changes and improvements.
README.mdfile with updated instructions and information.
1.1.0 #
Added
- Implemented a
Streamthat checks internet connectivity every 10 seconds, emitting a new state if the connection status changes. - Introduced the
autoCheckoption to control whether internet connectivity should be checked automatically. Set tofalseto disable automatic checks. - Added an option to customize the check interval, controlling the time between connectivity checks.
- Created an
Objectfor translations, allowing easier addition or customization of translations, such as Arabic or specific texts to display when no internet connection is available.
Changed
- Updated the
builderwidget to remove the direct ability to addnoInternetScreen. Customization of the no internet screen is now done via the builder function, providing greater flexibility in UI design.