Skip to content

Upgrading clock 0.1 to 1

Breaking0.1.2 → 1.1.3Breaking2Platform2Deprecated3New5Fixed3Other2

BreakingUpgrade verdict

2 breaking changes and 2 platform requirement changes.

  • Creating a clock now works differently: you pass a function that returns the current time.
  • You must now call `now()` with parentheses instead of reading it as a property.
  • This version needs Dart 3.4 or newer.
  • You need Dart 3.1.0 or newer to use this version.
Top 5 of 7 that need code or config changes

Requires Dart SDK ^3.4.0 from 1.1.2 (none stated before).

Breaking2
new Clock() now takes an optional positional argument returning the current time as a DateTime instead of its old arguments.
ClockDateTime
Clock.now() is now a method rather than a getter.
Clock.now()
Platform2
Requires Dart 3.4.
Requires Dart SDK ^3.1.0.
Deprecated3
Deprecates the top-level new getter and getStopwatch() methods in favor of clock.new() and clock.stopwatch().
newgetStopwatch()clock.new()clock.stopwatch()
Deprecates Clock.getStopwatch() in favor of Clock.stopwatch().
Clock.getStopwatch()Clock.stopwatch()
Deprecates the isFinal argument to withClock().
withClock()isFinal