Skip to content

[file_selector] "Save file" example is not web compatible. #130368

@ditman

Description

@ditman

Is there an existing issue for this?

Steps to reproduce

  1. Compile and run the file_selector example app in the web.
  2. Go to the "Save File" example
  3. Fill in the form and click "Press to save a text file."

Expected results

In the web, a dialog prompting the user where to save the text file should be displayed, and then the file "downloaded" to the disk of the user.

Actual results

There's an error in the JS console about a missing implementation of the path_provider plugin:

Uncaught (in promise) Error: MissingPluginException(No implementation found for method getApplicationDocumentsDirectory on channel plugins.flutter.io/path_provider)
    at Object.throw_ [as throw] (dart_sdk.js:5402:11)
    at MethodChannel._invokeMethod (text_editing_delta.dart.js:4433:21)
    at _invokeMethod.next (<anonymous>)
    at dart_sdk.js:39902:33
    at _RootZone.runUnary (dart_sdk.js:39737:59)
    at _FutureListener.thenAwait.handleValue (dart_sdk.js:35127:29)
    at handleValueCallback (dart_sdk.js:35709:49)
    at _Future._propagateToListeners (dart_sdk.js:35747:17)
    at [_completeWithValue] (dart_sdk.js:35588:23)
    at async._AsyncCallbackEntry.new.callback (dart_sdk.js:35622:35)
    at Object._microtaskLoop (dart_sdk.js:40214:13)
    at _startMicrotaskLoop (dart_sdk.js:40220:13)
    at dart_sdk.js:35968:9

Code sample

This is the problematic bit of code:

In the web (if (kIsWeb) {), that function call should be skipped, since it's not really needed by the plugin to determine where to save a file.

Screenshots or Video

n/a

Logs

n/a

Flutter Doctor output

n/a

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Issues that are less important to the Flutter projectc: crashStack traces logged to the consolefyi-webFor the attention of Web platform teamp: file_selectorThe file_selector pluginpackageflutter/packages repository. See also p: labels.team-ecosystemOwned by Ecosystem team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions