gg_fake_stopwatch 1.2.3 copy "gg_fake_stopwatch: ^1.2.3" to clipboard
gg_fake_stopwatch: ^1.2.3 copied to clipboard

A stopwatch that is in sync with FakeAsync.elapsed. Use this stopwatch in tests using fakeAsync.

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);
});

Features and bugs #

Please file feature requests and bugs at GitHub.

0
likes
160
points
100
downloads

Publisher

verified publisherinlavigo.com

Weekly Downloads

A stopwatch that is in sync with FakeAsync.elapsed. Use this stopwatch in tests using fakeAsync.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

More

Packages that depend on gg_fake_stopwatch