getClock method Null safety

Clock getClock(
  1. DateTime initialTime
)

Returns a fake Clock whose time can is elapsed by calls to elapse and elapseBlocking.

The returned clock starts at initialTime plus the fake time that's already been elapsed. Further calls to elapse and elapseBlocking will advance the clock as well.

Note that it's usually easier to use the top-level clock property. Only call this function if you want a different initialTime than the default.

Implementation

Clock getClock(DateTime initialTime) =>
    Clock(() => initialTime.add(_elapsed));