A Flutter package for constant internet connectivity checking throughout the app.
- Monitors internet connectivity.
- Displays a user-friendly screen when there is no internet connection.
- Customizable options for the internet connectivity screen.
- Add the
sync_sphere
package to yourpubspec.yaml
file:
dependencies:
sync_sphere: ^0.0.3
- Run pub get
flutter pub get
- import your package
import 'package:sync_sphere/sync_sphere.dart';
- Wrap child of your MaterialApp with the SyncSphere widget
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: SyncSphere(
child: YourMainScreen(),
whenOffine: YourOfflineScreenWidget(),
),
);
}
}
- You can also use the default "No internet" widget
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: SyncSphere(
child: YourMainScreen(),
),
);
}
}