withClock<T>  function 
 
- Clock clock,
- T callback(), {
- @Deprecated('This parameter is deprecated and should be avoided') bool isFinal = false,
Runs callback with the given value for the top-level clock field.
This is Zone-scoped, so asynchronous callbacks spawned within callback
will also use the new value for clock.
If isFinal is true, calls to withClock within callback will throw a
StateError. However, this parameter is deprecated and should be avoided.
Implementation
// ignore: deprecated_member_use_from_same_package
/// If [isFinal] is `true`, calls to [withClock] within [callback] will throw a
/// [StateError]. However, this parameter is deprecated and should be avoided.
T withClock<T>(
  Clock clock,
  T Function() callback, {
  @Deprecated('This parameter is deprecated and should be avoided')
  bool isFinal = false,
}) {
  if ((Zone.current[_isFinalKey] ?? false) == true) {
    throw StateError(
        'Cannot call withClock() within a call to withClock(isFinal = true).');
  }
  return runZoned(callback,
      zoneValues: {_clockKey: clock, _isFinalKey: isFinal});
}