nc-photos/lib/connectivity_util.dart
2021-04-10 12:28:12 +08:00

11 lines
290 B
Dart

import 'package:connectivity/connectivity.dart';
Future<void> waitUntilWifi() async {
while (true) {
final result = await Connectivity().checkConnectivity();
if (result == ConnectivityResult.wifi) {
return;
}
await Future.delayed(const Duration(seconds: 5));
}
}