fconnectivity 0.0.1 copy "fconnectivity: ^0.0.1" to clipboard
fconnectivity: ^0.0.1 copied to clipboard

Connectivity package that contains useful utilities for checking if device is connected to the internet.

fconnectivity #

A Flutter package that provides utilities for checking internet connectivity status. It allows developers to easily manage and respond to changes in internet access state within their applications.

Usage #

Somewhere in your code, you should inject the InternetAccessCubit:

For example using BlocProvider:

@override
Widget build(BuildContext context) {
  return BlocProvider(
    create: (context) => InternetAccessCubit(), 
    child: YourWidget(),
  );
}

Then you can use the InternetAccessCubitListener widget to listen to the internet access state (make sure the InternetAccessCubit is provided somewhere in the widget tree above this widget):

@override
Widget build(BuildContext context) {
  return const InternetAccessCubitListener(
    onHasInternetAccess: (context, isFirstCapturedState) =>
        print('Connected to the internet'),
    onHasNoInternetAccess: (context, isFirstCapturedState) =>
        print('Disconnected from the internet'),
    child: YourWidget(),
  );
}
3
likes
0
pub points
0%
popularity

Publisher

unverified uploader

Connectivity package that contains useful utilities for checking if device is connected to the internet.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

connectivity_plus, flutter, flutter_bloc, internet_connection_checker_plus

More

Packages that depend on fconnectivity