Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter: file_picker_error, Temporary file could not be created

Tags:

macos

ios

flutter

I am getting this error, in flutter code, on Mac M1:

[MethodChannelFilePicker] Platform exception: PlatformException(file_picker_error, Temporary file could not be created, Error Domain=NSItemProviderErrorDomain Code=-1000 "Cannot load representation of type public.item" UserInfo={NSLocalizedDescription=Cannot load representation of type public.item}, null) [VERBOSE-2:ui_dart_state.cc(209)] Unhandled Exception: PlatformException(file_picker_error, Temporary file could not be created, Error Domain=NSItemProviderErrorDomain Code=-1000 "Cannot load representation of type public.item" UserInfo={NSLocalizedDescription=Cannot load representation of type public.item}, null)

final result = await FilePicker.platform.pickFiles(
    allowMultiple: false,
    type: FileType.image,
);

I also inserted this code in info.plist:

<key>UIBackgroundModes</key>
<array>
    <string>fetch</string>
    <string>remote-notification</string>
</array>
<key>NSAppleMusicUsageDescription</key>
<string>Explain why your app uses music</string>
<key>UISupportsDocumentBrowser</key>
<true/>
<key>LSSupportsOpeningDocumentsInPlace</key>
<true/>

any suggestions?

like image 994
Maurizio Mancini Avatar asked Jan 23 '26 19:01

Maurizio Mancini


2 Answers

You are probably trying with the photo of the pink flowers on the simulator — that's a known iOS simulator issue since iOS 14. Please ignore it or test it on a real device.

like image 82
Gourango Sutradhar Avatar answered Jan 26 '26 10:01

Gourango Sutradhar


this error is due to the fact that you probably select the flower images in the emulator I found the solution to this problem at this link

https://github.com/miguelpruivo/flutter_file_picker/issues/997#issuecomment-1070981727

like image 31
Ulrich Nembot Avatar answered Jan 26 '26 10:01

Ulrich Nembot



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!