1
0
Fork 0
mirror of https://gitlab.com/nkming2/nc-photos.git synced 2025-03-25 16:34:41 +01:00
nc-photos/app/lib/async_util.dart

11 lines
233 B
Dart
Raw Normal View History

2021-11-19 21:46:07 +08:00
import 'dart:async';
Future<void> wait(
FutureOr<bool> Function() condition, {
Duration? pollInterval,
}) async {
while (!await condition()) {
await Future.delayed(pollInterval ?? const Duration(milliseconds: 500));
}
}