setUpdateCheckToday static method

void setUpdateCheckToday()

Implementation

static void setUpdateCheckToday() {
  final now = DateTime.now();

  final formatted = _formatter.format(now);
  var configFile = getFileConfig();
  var lines = configFile.readAsLinesSync();
  var lastUpdateIndex = lines.indexWhere(
    (element) => element.startsWith('last_update_check:'),
  );
  if (lastUpdateIndex != -1) {
    lines.removeAt(lastUpdateIndex);
  }

  lines.add('last_update_check: $formatted');
  configFile.writeAsStringSync(lines.join('\n'));
}