writeAsBytesSync method
void
writeAsBytesSync(
- List<
int> bytes, { - required BuildContext context,
- dynamic mode = FileMode.write,
- bool flush = false,
Calling writeAsBytesSync method.
FileSaver fileSaver = FileSaver(
initialFileName:'File Name',
fileTypes: const ['txt'],
);
fileSaver.writeAsBytesSync(bytes, context:context);
Implementation
void writeAsBytesSync(List<int> bytes,
{required BuildContext context,
mode = FileMode.write,
bool flush = false}) async {
return filebrowser(context, this).then((path) {
if (path != null) {
_successMessage(context, style);
if (File(path).existsSync()) {
File(path).writeAsBytesSync(
bytes,
mode: FileMode.write,
flush: flush,
);
} else {
File(path).writeAsBytesSync(
bytes,
mode: mode,
flush: flush,
);
}
}
});
}