writeFile method
Writes data to a file at the specified path.
Implementation
@override
Future<void> writeFile(String path, List<int> data) async {
final filePath = resolvePath(path);
final file = File(filePath);
// If the path exists and is a directory, throw
if (await FileSystemEntity.type(filePath) ==
FileSystemEntityType.directory) {
throw FileSystemException(
"Cannot write to a directory as a file", filePath);
}
await file.parent.create(recursive: true);
await file.writeAsBytes(data);
}