0

I'm using file_picker_cross for Android. I cannot find any way to cancel the file picker after calling FilePickerCross.pick(). The method replaces the full screen with the file picker dialog with no cancel button. I can tap the Android's back button a few times to get back to the app but this always throws an exception. I don't see anything in the documentation about canceling. I tried catching the exception but even that did not work. Below is a code snip of what I have tried.

try {
  FilePickerCross.pick().then((filePicker) {
    //            ^ NoSuchMethodError: The getter 'path' was called on null.
    if (filePicker == null) {return;}

    // do stuff with filePicker (exception is thrown before we get here.)
  });
} catch (e) {
  // we never get here even though an exception is thrown.
}
Stack Underflow
  • 2,363
  • 2
  • 26
  • 51

1 Answers1

0

FilePickerCross.pick() is deprecated. Use FilePickerCross.importFromStorage() instead.

Tomerikoo
  • 18,379
  • 16
  • 47
  • 61