mirror of
https://gitlab.com/nkming2/nc-photos.git
synced 2025-01-23 09:16:19 +01:00
13 lines
388 B
Dart
13 lines
388 B
Dart
import 'package:connectivity_plus/connectivity_plus.dart';
|
|
import 'package:flutter/foundation.dart';
|
|
|
|
Future<void> waitUntilWifi({VoidCallback? onNoWifi}) async {
|
|
while (true) {
|
|
final result = await Connectivity().checkConnectivity();
|
|
if (result == ConnectivityResult.wifi) {
|
|
return;
|
|
}
|
|
onNoWifi?.call();
|
|
await Future.delayed(const Duration(seconds: 5));
|
|
}
|
|
}
|