recordUpdate method

bool recordUpdate()

Updates the last update date if the day stored currently is more than 5 minutes old compared to now.

Implementation

bool recordUpdate() {
  var lastUpdate = updatedAt;
  var now = DateTime.now();

  if (lastUpdate != null) {
    var diff = now.difference(lastUpdate).inMinutes;
    if (diff < 5) {
      return false;
    }
  }

  _update('updated_at', now.toUtc().toIso8601String());

  return true;
}