【发布时间】:2021-12-15 18:47:25
【问题描述】:
我将file_picker: ^4.2.0 show package 用于我的应用程序。
当我将网页发布为 html 时,出现一些错误。
错误:path always null in web release
我获取文件的代码:
Future getFile() async {
FilePickerResult? result = await FilePicker.platform.pickFiles(
withReadStream: true,
type: FileType.custom,
allowedExtensions: ['png', 'jpeg', 'jpg', 'pdf'],
);
if (result != null) {
PlatformFile file = result.files.single;
setState(() {
_file = File(file.path.toString());
_filePath = file.path;
});
_uploadFile();
} else {
// file not choose
}
}
【问题讨论】:
标签: flutter file-upload flutter-web filepicker.io