writeFile method
Write bytes
inside fileName
and return the path to the file.
fileName
: The name of the file (e.g:my_file.json
).bytes
: The data to write inside the file.
Implementation
@override
Future<String> writeFile({
required String fileName,
required Uint8List bytes,
}) async {
final splittedName = fileName.split('.');
final name = splittedName[0];
final mimeType = lookupMimeType(fileName) ?? 'application/octet-stream';
final downloaded = await _downloadFile(
bytes: bytes,
name: name,
type: mimeType,
);
return downloaded ? 'Downloads/$fileName' : '';
}