All Projects → marchdev-tk → cross_connectivity

marchdev-tk / cross_connectivity

Licence: BSD-3-Clause License
A Flutter plugin for handling Connectivity and REAL Connection state in the mobile, web and desktop platforms. Supports iOS, Android, Web, Windows, Linux and macOS.

Programming Languages

dart
5743 projects
C++
36643 projects - #6 most used programming language
ruby
36898 projects - #4 most used programming language
Batchfile
5799 projects
c
50402 projects - #5 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to cross connectivity

flutter sliding tutorial
User onboarding library with smooth animation of objects and background colors
Stars: ✭ 127 (+370.37%)
Mutual labels:  flutter-plugin, dart2, flutter-package
swipedetector
A Flutter package to detect up, down, left, right swipes.
Stars: ✭ 34 (+25.93%)
Mutual labels:  flutter-plugin, dart2, flutter-package
flutter google maps
A Flutter plugin for integrating Google Maps in iOS, Android and Web applications. It is a wrapper of google_maps_flutter for Mobile and google_maps for Web.
Stars: ✭ 86 (+218.52%)
Mutual labels:  flutter-plugin, dart2, flutter-package
flutter-app
Full Feature Todos Flutter Mobile app with fireStore integration.
Stars: ✭ 138 (+411.11%)
Mutual labels:  flutter-plugin, dart2, flutter-package
davinci
A flutter package to convert any widget to an Image.
Stars: ✭ 33 (+22.22%)
Mutual labels:  flutter-plugin, flutter-package
FlutterLoadingGIFs
Loading indicator GIFs. Material and Cupertino (Android and iOS) loading indicators in assorted sizes. Use as placeholders for loading remote image assets. Demo: https://gallery.codelessly.com/flutterwebsites/loadinggifs/
Stars: ✭ 28 (+3.7%)
Mutual labels:  flutter-plugin, flutter-package
gen lang
gen_lang is a dart library for internationalization. Extracts messages to generate dart files required by Intl, inspired by Intl_translation and Flutter i18n
Stars: ✭ 94 (+248.15%)
Mutual labels:  flutter-plugin, flutter-package
qrcode
A flutter plugin for scanning QR codes. Use AVCaptureSession in iOS and zxing in Android.
Stars: ✭ 69 (+155.56%)
Mutual labels:  flutter-plugin, flutter-package
link text
Easy to use text widget for Flutter apps, which converts inlined urls into working, clickable links
Stars: ✭ 20 (-25.93%)
Mutual labels:  flutter-plugin, flutter-package
survey kit
Flutter library to create beautiful surveys (aligned with ResearchKit on iOS)
Stars: ✭ 68 (+151.85%)
Mutual labels:  flutter-plugin, flutter-package
flutter-devicelocale
A Flutter package to read and return the set device locales
Stars: ✭ 45 (+66.67%)
Mutual labels:  flutter-plugin, flutter-package
liquid button
Liquify your buttons, web demo at website
Stars: ✭ 18 (-33.33%)
Mutual labels:  flutter-plugin, flutter-package
Motion-Tab-Bar
A beautiful animated flutter widget package library. The tab bar will attempt to use your current theme out of the box, however you may want to theme it.
Stars: ✭ 237 (+777.78%)
Mutual labels:  flutter-plugin, flutter-package
lang table
lang_table is a dart plugin to generate string files from a source. Use a table to manage all multi-language resources. Inspired by fetch-mobile-localization-from-airtable
Stars: ✭ 17 (-37.04%)
Mutual labels:  flutter-plugin, flutter-package
reactive state
An easy to understand reactive state management solution for Flutter.
Stars: ✭ 19 (-29.63%)
Mutual labels:  flutter-plugin, flutter-package
pub-scaff
scaff, scaffold generator for Dart and Flutter
Stars: ✭ 27 (+0%)
Mutual labels:  flutter-plugin, dart2
getx snippets extension
An extension to accelerate the process of developing applications with flutter, aimed at everyone using the GetX package.
Stars: ✭ 142 (+425.93%)
Mutual labels:  flutter-plugin, flutter-package
connection checker
Android library for checking the internet connectivity of a device.
Stars: ✭ 26 (-3.7%)
Mutual labels:  internet-connection, internet-connectivity
fancy bar
A fancy yet beautiful animated widget for your Flutter apps
Stars: ✭ 33 (+22.22%)
Mutual labels:  flutter-plugin, flutter-package
simple gesture detector
Easy to use, reliable and lightweight gesture detector for Flutter apps, exposing simple API for basic gestures
Stars: ✭ 26 (-3.7%)
Mutual labels:  flutter-plugin, flutter-package

cross_connectivity

Build Pub GitHub GitHub stars

A Flutter plugin for handling Connectivity and REAL Connection state in the mobile, web and desktop platforms. Supports iOS, Android, Web, Windows, Linux and macOS.

Getting Started

In order to use this plugin, add dependency in the pubspec.yaml:

cross_connectivity: any

or

cross_connectivity:
    git:
      url: https://github.com/marchdev-tk/cross_connectivity

Add an import to dart file:

import 'package:cross_connectivity/cross_connectivity.dart';

Samples

Web sample:

Web Sample

Desktop sample:

Desktop Sample

Mobile sample:

Mobile Sample

Usage

Functional approach

This plugin provides two streams:

  • isConnected that shows whether the device is REALLY connected to the network or not.
  • onConnectivityChanged that it will not let you know about state of the REAL network connection. It only shows connectivity state.

Also for one time check could be used following methods:

  • checkConnection() that is working like isConnected, but returns Future<bool> instread of Stream<bool>.
  • checkConnectivity() that is working like onConnectivityChanged, but returns Future<ConnectivityStatus> instread of Stream<ConnectivityStatus>.

There are no more methods (they are working only on Android/iOS/macOS):

  • getWifiName() - Obtains the wifi name (SSID) of the connected network.
  • getWifiBSSID() - Obtains the wifi BSSID of the connected network.
  • getWifiIP() - Obtains the IP address of the connected wifi network.

They are removed to wifi_info_flutter.

Migration guide:

If you don't use any of the above APIs, your code should work as is. In addition, you can also remove NSLocationAlwaysAndWhenInUseUsageDescription and NSLocationWhenInUseUsageDescription in ios/Runner/Info.plist

If you use any of the above APIs, you can find the same APIs in the wifi_info_flutter plugin. For example, to migrate getWifiName, use the new plugin:

final WifiInfo _wifiInfo = WifiInfo();
final String wifiName = await _wifiInfo.getWifiName();

Widget approach

As an alteration to funcitonal approach could be used ConnectivityBuilder widget as follows:

ConnectivityBuilder(
  builder: (context, isConnected, status) => Row(
    mainAxisSize: MainAxisSize.min,
    children: <Widget>[
      Icon(
        isConnected == true
            ? Icons.signal_wifi_4_bar
            : Icons.signal_wifi_off,
        color: isConnected == true ? Colors.green : Colors.red,
      ),
      const SizedBox(width: 8),
      Text(
        '$status',
        style: TextStyle(
          color: status != ConnectivityStatus.none
              ? Colors.green
              : Colors.red,
        ),
      ),
    ],
  ),
)

Feature requests and Bug reports

Feel free to post a feature requests or report a bug here.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].