extension_async.dart
Dart•マスター
Explorer
C40
C++40
C#40
Dart
初級10
中級10
上級10
エキスパート5
マスター5
stream_transformer.dart
isolate_compute.dart
mixin_state.dart
extension_async.dart
zone_error.dart
Go40
Java40
JavaScript40
Kotlin40
Objective-C40
Perl40
PHP40
Python40
R40
Ruby40
Rust40
Shell40
Swift40
TypeScript40
extension_async.dart
Click to focus
1
2
3
4
5
6
7
8
9
10
11
12
13
14
extension FutureX<T> on Future<T> {↵
Future<T> retry(int times) async {↵
for (int i = 0; i < times; i++) {↵
try {↵
return await this;↵
} catch (e) {↵
if (i == times - 1) rethrow;↵
await Future.delayed(Duration(seconds: i + 1));↵
}↵
}↵
throw 'Failed';↵
}↵
}↵
await fetchData().retry(3);
0WPM•0%•0:00•0/377(0%)|Ln 1, Col 1
UTF-8•Dart