Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

features

coneectivity service is for checking the internet connection using provider.

installation

  1. add the latest version of package to your pubspec.yaml (and rundart pub get):
dependencies:
  connectivity_service: ^0.0.3
  1. import the package and use it in your flutter app.
import 'package:connectivity_service/connectivity_service.dart';

example

  1. add the provider in mateerial app
import 'package:flutter/material.dart';
void main() {
  runapp(const myapp());
}

class myapp extends statelesswidget {
  const myapp({key? key}) : super(key: key);

  // this widget is the root of your application.
  @override
  widget build(buildcontext context) {
    return multiprovider(
      providers: [
        streamprovider<connectivitysatus>(
            create: (context) =>
                coneectivityservice().connectionstatuscontroller.stream,
            initialdata: connectivitysatus.offline)
      ],
      child: materialapp(
        title: 'flutter application',
        theme: themedata(
          primaryswatch: colors.blue,
        ),
        home: const homepage(),
      ),
    );
  }
}
  1. then add ‘networksensitive’ where you need.
import 'package:connectivity_service/enum/network_sensitivity.dart';
import 'package:flutter/material.dart';

class homepage extends statefulwidget {
  const homepage({key? key}) : super(key: key);

  @override
  state<homepage> createstate() => _homepagestate();
}

class _homepagestate extends state<homepage> {
  @override
  widget build(buildcontext context) {
    return scaffold(
      body: safearea(
        child: networksensitive(
          child:text('your design here'),
        ),
      ),
    );
  }
}
  1. in ‘networksensitive’ page you can create your own design on the offline section. for now it is a simple text ‘no internet!’ but you can design here anything.

Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

Top