getFileId method

void getFileId()

Implementation

void getFileId() {
  var maxFileName = "";
  for (var pathStr in files()) {
    var name = Path.basename(pathStr);
    name = name.replaceAll(".log", "");
    maxFileName = maxFileName.compareTo(name) < 0 ? name : maxFileName;
  }
  if (DateTime.tryParse(maxFileName) != null &&
      DateTime.now()
          .subtract(Duration(hours: _hours))
          .isBefore(DateTime.parse(maxFileName))) {
    _fileId = maxFileName;
  } else {
    _fileId = _format.format(DateTime.now());
  }
}