internet_connectivity_check 0.0.2 copy "internet_connectivity_check: ^0.0.2" to clipboard
internet_connectivity_check: ^0.0.2 copied to clipboard

This package provides information about the state of internet connection. A permenant solution to Connectivity check problems arising from enabled wifi or mobile data with no internet Access.

example/lib/main.dart

import 'package:flutter/material.dart';

import 'package:internet_connectivity_check/internet_connectivity_check.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'Flutter Demo',
      home: HomeScreen(),
    );
  }
}

class HomeScreen extends StatefulWidget {
  const HomeScreen({super.key});

  @override
  State<HomeScreen> createState() => _HomeScreenState();
}

class _HomeScreenState extends State<HomeScreen> {
  @override
  void initState() {
    super.initState();
    checkCon();
  }

  checkCon() async {

    // Sending a request to check the status of Internet Connection
    bool connection = await checkInternetStatus();
 // Prinitng the Response
    print(connection);
  }

  @override
  Widget build(BuildContext context) {
    Size size = MediaQuery.of(context).size;

    return Scaffold(
      body: SafeArea(
          child: SizedBox(
        width: size.width,
        height: size.height,
        child: const Column(
          children: [],
        ),
      )),
    );
  }
}
2
likes
130
points
29
downloads

Publisher

unverified uploader

Weekly Downloads

This package provides information about the state of internet connection. A permenant solution to Connectivity check problems arising from enabled wifi or mobile data with no internet Access.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter, http

More

Packages that depend on internet_connectivity_check