nc-photos/lib/connectivity_util.dart
2021-07-12 21:29:49 +08:00

11 lines
300 B
Dart

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