internet_connectivity_check 0.0.1 internet_connectivity_check: ^0.0.1 copied to clipboard
This package provides the info about internet connectiviy.
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 {
bool connection = await checkInternetStatus();
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: [],
),
)),
);
}
}