connected 0.1.0+16 copy "connected: ^0.1.0+16" to clipboard
connected: ^0.1.0+16 copied to clipboard

Flutter package for build real internet connection notifier on widget tree.

CONNECTED

Are you sure you are connected?

A Flutter package to check your internet connection and show result as widget on your screen!

This library provides functionality to monitor and verify internet connectivity by checking reachability to various Uris. It relies on the 'internet_connection_checker_plus' => connectivity_plus package for listening to connectivity changes and the http package for making network requests.

Features #

  • Check internet connectivity status
  • Listen for internet connectivity changes and show it on your screen as widget
  • You can customize connected and disconnected widget

Supported Platforms #

Platform Check Connectivity Listen for Changes
Android
iOS
macOS
Linux
Windows
Web

Getting started #

Android #

Add the following permissions to your AndroidManifest.xml file:

<uses-permission android:name="android.permission.INTERNET" />

macOS #

Add the following permissions to your macOS .entitlements files:

<key>com.apple.security.network.client</key>
<true/>

For more information, see the [Flutter Networking Documentation].

Usage #

1. Add dependency #

Add the internet_connection_checker_plus package to your pubspec.yaml file:

dependencies:
  connected: [latest version]

2. Import the package #

Import the connected package into your Dart file:

import 'package:connected/connected.dart';

3. Checking for internet connectivity #

The simplest way to check for internet connectivity is to use the NetworkService() class:

Future<bool> get hasConnection async => await NetworkService().isConnected;

Additional information #

4. Listening for internet connectivity changes #

Wrap "widget" in builder of MaterialApp with Connected()

      child: MaterialApp(
        navigatorKey: NavigationService.instance.navigationKey,
        debugShowCheckedModeBanner: false,
        builder: (context, widget) {
          return Connected(widget: widget ?? MySizedBox.h0);
        },
        home: App(),
      )
9
likes
100
pub points
62%
popularity

Publisher

unverified uploader

Flutter package for build real internet connection notifier on widget tree.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

connectivity_plus, dio, flutter

More

Packages that depend on connected