miguelpruivo/flutter_file_picker

Adding `opml` to file extensions throws `PlatformException` exception

Closed this issue · 4 comments

Describe the bug
I would like to use the allowedExtensions parameter to only allow opml extensions. Unfortunately, it seems that opml is not supported on Android. Everything works fine when I use the FileType.any.

Platform

  • Android

Platform OS version
Android 14

How are you picking?

FilePicker.platform.pickFiles(
    allowedExtensions: ['opml'],
    type: FileType.custom,
)

Error Log

I/flutter (14449): [MethodChannelFilePicker] Platform exception: PlatformException(FilePicker, Unsupported filter. Make sure that you are only using the extension without the dot, (ie., jpg instead of .jpg). This could also have happened because you are using an unsupported file extension.  If the problem persists, you may want to consider using FileType.all instead., null, null)
E/flutter (14449): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(FilePicker, Unsupported filter. Make sure that you are only using the extension without the dot, (ie., jpg instead of .jpg). This could also have happened because you are using an unsupported file extension.  If the problem persists, you may want to consider using FileType.all instead., null, null)
E/flutter (14449): #0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:651:7)
E/flutter (14449): #1      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:334:18)
E/flutter (14449): <asynchronous suspension>
E/flutter (14449): #2      MethodChannel.invokeListMethod (package:flutter/src/services/platform_channel.dart:520:35)
E/flutter (14449): <asynchronous suspension>
E/flutter (14449): #3      FilePickerIO._getPath (package:file_picker/src/file_picker_io.dart:92:33)
E/flutter (14449): <asynchronous suspension>
E/flutter (14449): #4      _FeedViewState._import.<anonymous closure> (package:your_news/feed/views/feed_page.dart:95:17)
E/flutter (14449): <asynchronous suspension>
E/flutter (14449): #5      _FeedViewState.build.<anonymous closure>.<anonymous closure>.<anonymous closure>.<anonymous closure>.<anonymous closure>.<anonymous closure> (package:your_news/feed/views/feed_page.dart:222:39)
E/flutter (14449): <asynchronous suspension>
E/flutter (14449): #6      CancelableCompleter.complete.<anonymous closure> (package:async/src/cancelable_operation.dart:425:16)
E/flutter (14449): <asynchronous suspension>
E/flutter (14449): 

Flutter Version details
Flutter (Channel beta, 3.18.0-0.2.pre, on Microsoft Windows [Version 10.0.19045.3930], locale en-US)
• Flutter version 3.18.0-0.2.pre on channel beta
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision fed06b31d9 (4 weeks ago), 2023-12-13 14:53:33 -0800
• Engine revision 39c6dc9bdd
• Dart version 3.3.0 (build 3.3.0-174.3.beta)
• DevTools version 2.30.0

Additional context
The problem seems to be addressed on iOS as mentioned here: https://github.com/miguelpruivo/flutter_file_picker/wiki/Troubleshooting#-issue-9

This issue is stale because it has been open for 14 days with no activity.

Could someone comment on this issue?

This issue is stale because it has been open for 14 days with no activity.

This issue was closed because it has been inactive for 14 days since being marked as stale.