When picking the file with filter by extension, it allow to choose any file regardless of the extension. And when you pick the file with unsupported extension, flutter_file_dialog just crashes with platform exception.
Code
final params = OpenFileDialogParams(
dialogType: OpenFileDialogType.document,
sourceType: SourceType.photoLibrary,
fileExtensionsFilter: [ 'pdf', 'doc', 'docx' ],
);
final filePath = await FlutterFileDialog.pickFile(params: params);
Exception
2022-10-01 17:49:39 +0000 [SwiftFlutterFileDialogPlugin.swift:24 handle(_:result:)] pickFile
2022-10-01 17:49:39 +0000 [OpenFileDialog.swift:20 deinit] OpenFileDialog.deinit
[DocumentManager] Failed to associate thumbnails for picked URL file:///private/var/mobile/Library/Mobile%20Documents/com~apple~CloudDocs/Desktop/%D0%A1%D0%BD%D0%B8%D0%BC%D0%BE%D0%BA%20%D1%8D%D0%BA%D1%80%D0%B0%D0%BD%D0%B0%202022-09-29%20%D0%B2%2010.48.01.png with the Inbox copy file:///private/var/mobile/Containers/Data/Application/C87255ED-FC01-484D-B95F-AF1BB05FE151/tmp/com.schtandart.online-Inbox/%D0%A1%D0%BD%D0%B8%D0%BC%D0%BE%D0%BA%20%D1%8D%D0%BA%D1%80%D0%B0%D0%BD%D0%B0%202022-09-29%20%D0%B2%2010.48.01.png: Error Domain=QLThumbnailErrorDomain Code=115 "(null)" UserInfo={NSErrorFailingURLKey=file:///private/var/mobile/Library/Mobile%20Documents/com~apple~CloudDocs/Desktop/%D0%A1%D0%BD%D0%B8%D0%BC%D0%BE%D0%BA%20%D1%8D%D0%BA%D1%80%D0%B0%D0%BD%D0%B0%202022-09-29%20%D0%B2%2010.48.01.png}
2022-10-01 17:49:44 +0000 [OpenFileDialog.swift:140 documentPicker(_:didPickDocumentsAt:)] didPickDocumentsAt
2022-10-01 17:49:44 +0000 [OpenFileDialog.swift:154 handlePickedFile(_:)] handlePickedFile: /private/var/mobile/Containers/Data/Application/C87255ED-FC01-484D-B95F-AF1BB05FE151/tmp/com.schtandart.online-Inbox/Снимок экрана 2022-09-29 в 10.48.01.png
[VERBOSE-2:dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(invalid_file_extension, Invalid file type was picked, png, null)
#0 StandardMethodCodec.decodeEnvelope
package:flutter/…/services/message_codecs.dart:653
#1 MethodChannel._invokeMethod
package:flutter/…/services/platform_channel.dart:296
<asynchronous suspension>
#2 _MediaFieldState._takePicture
package:schtd_dealer/…/common/media_field.dart:299
Platform: iOS
Flutter 3.3.3
When picking the file with filter by extension, it allow to choose any file regardless of the extension. And when you pick the file with unsupported extension,
flutter_file_dialogjust crashes with platform exception.Code
Exception
Platform: iOS
Flutter 3.3.3