Skip to content

Commit

Permalink
throws exception when bytes are null
Browse files Browse the repository at this point in the history
  • Loading branch information
vicajilau committed Feb 11, 2025
1 parent 44d0972 commit 8be4e15
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/src/file_picker_io.dart
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,17 @@ class FilePickerIO extends FilePicker {
Uint8List? bytes,
bool lockParentWindow = false}) {
if (Platform.isIOS || Platform.isAndroid) {
if (bytes == null) {
throw ArgumentError(
'Bytes are required on Android & iOS when saving a file.');
}

return _channel.invokeMethod("save", {
"fileName": fileName,
"fileType": type.name,
"initialDirectory": initialDirectory,
"allowedExtensions": allowedExtensions,
"bytes": bytes ?? Uint8List(0),
"bytes": bytes,
});
}
return super.saveFile(
Expand Down

0 comments on commit 8be4e15

Please sign in to comment.