NowCallback typedef Views

NowCallback = DateTime Function()

A callback that returns the current DateTime representing "now" for the calendar.

See ViewConfiguration.nowCallback for what it affects. Any DateTime subtype works, so it can return local time, UTC, or a TZDateTime in a specific zone.

Pass the same function on every build, since it is included in the view configuration's equality. These qualify:

  • a tear-off, such as DateTime.now or a top-level or static function,
  • a closure stored in a field, which matters when the callback needs a captured value such as a location.

A closure written inline does not. It is a new function every build.

Implementation

typedef NowCallback = DateTime Function();