run method
Method that will be executed in the functionality. Remember when overrided to establish async.
Implementation
@override
Future<void> run() async {
DateTime dateTime = new DateTime.now();
Directory historyDirectory = Directory(
this._historyFolderPath + '/' + dateTime.year.toString()); // year
if (!historyDirectory.existsSync())
historyDirectory.create(recursive: true);
historyDirectory = Directory(this._historyFolderPath +
'/' +
dateTime.year.toString() +
'/' +
dateTime.year.toString() +
'-' +
(dateTime.month < 10
? '0' + dateTime.month.toString()
: dateTime.month.toString())); // month
if (!historyDirectory.existsSync())
historyDirectory.create(recursive: true);
File historyFile = File(historyDirectory.path +
'/' +
dateTime.toString().split(' ')[0]); // day (file)
if (!historyFile.existsSync()) historyFile.create(recursive: true);
historyFile.writeAsString(
'[' + dateTime.toString() + '] ' + this._entry + '\n',
mode: FileMode.append);
}