timeSinceLastUpdate method

Future<Duration?> timeSinceLastUpdate()

Calculates the duration since the last update, or null if never updated.

Returns the time elapsed since the last update or null if the value has never been updated.

Implementation

Future<Duration?> timeSinceLastUpdate() async {
  final last = await lastUpdate.get();
  return last == null ? null : DateTime.now().difference(last);
}