savePublic method
Implementation
Future<File> savePublic({bool autoName = true}) async {
if (autoName) {
final ext = filename.split(".").last;
final uuid = Uuid().v4();
final newFileName = "$uuid.$ext";
final file = File("lib/src/http/public/img/$newFileName");
if (!await file.exists()) await file.create(recursive: true);
final bytes = await _cachedBytes;
await file.writeAsBytes(bytes);
return file;
} else {
final file = File("lib/src/http/public/img/$filename");
if (!await file.exists()) await file.create(recursive: true);
final bytes = await _cachedBytes;
await file.writeAsBytes(bytes);
return file;
}
}