【问题标题】:Flutter file explorer not working with file_pickerFlutter 文件资源管理器无法与 file_picker 一起使用
【发布时间】:2022-01-22 10:23:29
【问题描述】:

对不起,我是新手。
我创建了一个按钮,它应该运行以下函数(我想,这也应该打开文件资源管理器)但它不起作用。 Button 在那里,但如果按下它,则不会发生任何其他事情。


  Padding newPadding() {
    return new Padding(
      padding: const EdgeInsets.only(top: 50.0, bottom: 20.0),
        child: ElevatedButton(
          onPressed:_openFileExplorer,
          child: const Text("Open File picker"),
                ),
              );
  }

FilePickerResult? result = await FilePicker.platform.pickFiles();

    if (result != null) {
      PlatformFile file = result.files.first;
      print(file.path);
    }    
    else {
  // User canceled the picker
  } 
}


我忘记了什么?

【问题讨论】:

    标签: ios flutter dart


    【解决方案1】:

    file_picker 包需要一些步骤才能在 ios 上正常工作。

    请查看以下链接中的设置说明:

    file_picker ios setup

    【讨论】:

    • 我已经将其中一些添加到 Info.plst 中,例如 ``` UIBackgroundModesfetchremote -notificationUISupportsDocumentBrowserLSSupportsOpeningDocumentsInPlace ```
    • 能否请您在按下按钮时捕获控制台日志@FloSojer
    • 颤动:[MethodChannelFilePicker] 不支持的操作。找不到方法。抛出的异常是:MissingPluginException(No implementation found for method any on channel miguelruivo.flutter.plugins.filepicker)
    • 我建议你“flutter clean”你的项目,然后再次“flutter pub get”和“flutter run”。
    • 我做到了 - 我仍然得到同样的错误
    猜你喜欢
    • 2022-10-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-09-22
    • 1970-01-01
    • 2018-04-21
    • 2021-08-16
    • 1970-01-01
    相关资源
    最近更新 更多