Skip to content

Commit 4d2ac92

Browse files
committed
Added documentation comments
1 parent 302c49e commit 4d2ac92

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

app/lib/task/clock_control.dart

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,14 @@ Future<T> withClockControl<T>(
2727
}
2828

2929
extension FutureTimeout<T> on Future<T> {
30+
/// Create a [Future] that will timeout after [timeLimit], and controllable
31+
/// by [ClockController].
32+
///
33+
/// This is the same as [timeout], except [ClockController.elapse] will also
34+
/// trigger this timeout, but will not trigger [timeout].
35+
///
36+
/// Use this if you need a timeout that will be fired when [clock] is advanced
37+
/// during testing. In production this should have no effect.
3038
Future<T> timeoutWithClock(
3139
Duration timeLimit, {
3240
FutureOr<T> Function()? onTimeout,
@@ -65,6 +73,14 @@ extension FutureTimeout<T> on Future<T> {
6573
}
6674

6775
extension ClockDelayed on Clock {
76+
/// Create a [Future] that is resolved after [delay], and controllable by
77+
/// [ClockController].
78+
///
79+
/// This is the same as [Future.delayed], except [ClockController.elapse] will
80+
/// also resolve this future, but will not resolve [Future.delayed].
81+
///
82+
/// Use this if you need a delay that will be fired when [clock] is advanced
83+
/// during testing. In production this should have no effect.
6884
Future<void> delayed(Duration delay) {
6985
final clockCtrl = Zone.current[_clockCtrlKey];
7086
if (clockCtrl is ClockController) {

0 commit comments

Comments
 (0)