global_network 0.1.4

  • Readme
  • Changelog
  • Example
  • Installing
  • 70

global_network #

This package provides a GlobalNetwork widget that can be used in an application to display a network error screen during offline mode.

You no longer need to apply connection checks to various screens, just use this package and let the app user know about the connection issues.

Dependencies #

In pubspec.yaml use global_network as dependency to use this package

dependencies:
  global_network: <package_version>

How to Use? #

  • After adding dependency in pubspec.yaml firstly, import the package given below:
import 'package:global_network/global_network.dart';

  • Secondly wrap Material App as given:
  StreamProvider<ConnectivityStatus>(
      create: (BuildContext context) => ConnectivityService().connectionStatusController.stream,

      child: MaterialApp());

Example-

  StreamProvider<ConnectivityStatus>(
      create: (BuildContext context) => ConnectivityService().connectionStatusController.stream,

      child: MaterialApp(
           title: 'Global Network',
           theme: ThemeData(
           primarySwatch: Colors.blue,
      ),

      home:  HomePage(),
    ));
  • Now you are all set to use this package, just wrap your widget with the new widget GlobalNetwork to display the Internet connection error / warning screen.
GlobalNetwork(
      child: Scaffold(
        appBar: AppBar(title: Text("Global Network")),
        body: Center(child: Text("Network Connection Available")),
      ),
    );
  • Hurray!!!! Your screen is now network sensitive so whenever you'll lost internet connectivity an warning screen will be display.
  • Wrap only those widgets where you need to show "connection error screen"

How does the screen look like after using this? #

Full Implementation #

This package provides different types of error screens such as alertbox, bottlesheet, botmodel and fullscreen. To use the error screen other than the default, simply pass data to the type argument (example: type: Displaytype.alertbox).

GlobalNetwork(
      type: Displaytype.alertbox;
      child: Scaffold(
        appBar: AppBar(title: Text("Global Network")),
        body: Center(child: Text("Network Connection Available")),
      ),
    );

You'll get - #

This is how other types look like- #

Contributions #

Found any bug? Wants to add or suggest something new ideas ? #

  • Fork the repo
  • Fix the bug / add new features
  • Commit your changes to new branch
  • Push the changes
  • Create a pull request

New Features #

  • Customisable "warning screen" as per your requirements.
  • Will be able to display the Bottlesheet, Alert dialog etc.

Upcoming Features #

  • Will be able to display the game during offline mode
  • Will be able to add some exciting features that will engage the user during offline mode

Please don't forget to star the repo ( https://github.com/anki2jain/global_network ).

More star means more support.

[0.1.4] - Release. #

  • global_network is a package that can be used in any app ranging from small learning apps to large & complex apps in production.

  • I observed that when there are multiple screens in an app it is very time consuming to implement network check on individual screen.

  • With this package this problem will become much simpler. No need to use network check at individual screen just use this package .

  • initially app is in offline mode issue fixed

[0.1.3] #

features added #

  • Will be able to display the Bottlesheet, Alert dialog etc.
  • Customisable "warning screen" as per your requirements.

example/example.dart

import 'package:flutter/material.dart';
import 'package:global_network/global_network.dart';

class Example extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return GlobalNetwork(
      child: Scaffold(
        appBar: AppBar(title: Text("Global Network")),
        body: Center(child: Text("Network Connection Available")),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  global_network: ^0.1.4

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:global_network/global_network.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
40
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
70
Learn more about scoring.

We analyzed this package on Jul 11, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.15
  • Flutter: 1.17.5

Analysis suggestions

Package does not support Flutter platform Linux

Because:

  • package:global_network/global_network.dart that imports:
  • package:global_network/utils/export.dart that imports:
  • package:global_network/services/network_connection.dart that imports:
  • package:connectivity/connectivity.dart that declares support for platforms: Android, iOS, macOS, Web

Package does not support Flutter platform Windows

Because:

  • package:global_network/global_network.dart that imports:
  • package:global_network/utils/export.dart that imports:
  • package:global_network/services/network_connection.dart that imports:
  • package:connectivity/connectivity.dart that declares support for platforms: Android, iOS, macOS, Web

Package not compatible with SDK dart

Because:

  • global_network that is a package requiring null.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
connectivity ^0.4.8+2 0.4.9
flutter 0.0.0
provider ^4.0.4 4.3.1
Transitive dependencies
collection 1.14.12 1.14.13
connectivity_for_web 0.3.0
connectivity_macos 0.1.0+3
connectivity_platform_interface 1.0.6
flutter_web_plugins 0.0.0
js 0.6.2
meta 1.1.8 1.2.2
nested 0.0.4
plugin_platform_interface 1.0.2
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8 2.1.0-nullsafety
Dev dependencies
flutter_test