readFileAsBase64 method
if path (entire Lunix or windows path) is provide, fileName must be null
- returns file as base64 string or null if file do not exists
Implementation
Future<String?> readFileAsBase64({String? fileName, String? path}) async {
File file =
File(validatePath(path) ?? "${await filesPath}$pathJoin$fileName");
return file.existsSync()
? base64Encode(
File(validatePath(path) ?? "${await filesPath}$pathJoin$fileName")
.readAsBytesSync())
: null;
}