Last updated:
0 purchases
gg fake stopwatch
GgFakeStopWatch #
The default stopwatch implementation does not work correctly when used in
a FakeAsync callback. With GgFakeStopwatch this is sovled.
Usage #
// Instantiate a fake `FakeAsync` callback.
fakeAsync((fakeAsync) {
// Create a GgFakeStopwatch instance handing over the fakeAsync instance.
final stopwatch = GgFakeStopwatch(fakeAsync: fakeAsync);
// Start the stopwatch
stopwatch.start();
// Elapse some time
fakeAsync.elapse(Duration(seconds: 1));
// Stopwatch.elapsed is in sync with fakeAsync.elapsed:
assert(fakeAsync.elapsed == stopwatch.elapsed);
});
copied to clipboard
Features and bugs #
Please file feature requests and bugs at GitHub.
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.