Part of PalestineDevelopers
Lightweight internet connection test, lookup Google domain.
- Periodic internet connection tests
- dispose method
To start, import package
import 'package:palestine_connection/palestine_connection.dart';
Just as easy as this
final PalConnection connection = PalConnection();
connection.initialize(
domain: PalDomain.random, // Domain To Test On (optional)
periodicInSeconds: 3, // 3 seconds
onConnectionLost: () {
// No Internet
},
onConnectionRestored: () {
// Internet is back
},
);
It could get more easier actually
PalConnection().initialize(
periodicInSeconds: 3, // 3 seconds
onConnectionLost: () {
// No Internet
},
onConnectionRestored: () {
// Internet is back
},
);
Then you could dispose it
connection.dispose();