internet_connectivity_check 0.0.2 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.
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: [],
),
)),
);
}
}