getFileName method
Implementation
String getFileName() {
var now = DateTime.now();
var fileName = fileNamePattern
.replaceAll('@yyyy', now.year.toString().padLeft(4, '0'))
.replaceAll('@MM', now.month.toString().padLeft(2, '0'))
.replaceAll('@dd', now.day.toString().padLeft(2, '0'))
.replaceAll('@HH', now.hour.toString().padLeft(2, '0'))
.replaceAll('@mm', now.minute.toString().padLeft(2, '0'))
.replaceAll('@ss', now.second.toString().padLeft(2, '0'))
.replaceAll('@id', _fileId.toString());
var file = File('$location/$fileName');
if (file.existsSync()) {
var size = BinarySize()..bytesCount = file.lengthSync();
if (size > singleFileSizeLimit) {
_fileId = getNextId();
return getFileName();
}
}
return fileName;
}