flml_internet_checker 0.0.7 flml_internet_checker: ^0.0.7 copied to clipboard
This package aims to check internet connection by just wrapping the widget with InternetChecker Widget without using any function calls inside your app"
import 'package:flml_internet_checker/flml_internet_checker.dart';
import 'package:flutter/material.dart';
import 'package:lottie/lottie.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: 'Internet Checker',
home: HomeScreen(),
);
}
}
class HomeScreen extends StatefulWidget {
const HomeScreen({super.key});
@override
State<HomeScreen> createState() => _HomeScreenState();
}
class _HomeScreenState extends State<HomeScreen> {
@override
Widget build(BuildContext context) {
return InternetChecker(
placeHolder: Lottie.asset(
"assets/no_internet.json",
height: 250,
),
internetConnectionText: "No Internet Connection",
child: const Scaffold(
body: Center(
child: Text("You are Online"),
),
),
);
}
}