【问题标题】:How to use image_picker plugin in flutter desktop without go-flutter如何在没有 go-flutter 的情况下在 Flutter 桌面中使用 image_picker 插件
【发布时间】:2020-05-10 20:00:27
【问题描述】:

我正在尝试在我的颤振桌面项目中使用 image_picker 插件,但我认为这个插件没有与 Windows 桌面应用程序一起使用的实现。 有人有解决方案吗? Ps:我想使用 go-flutter 和 hover。

【问题讨论】:

    标签: image flutter picker flutter-desktop


    【解决方案1】:

    有两种选择:

    【讨论】:

      【解决方案2】:
      File image;
        final picker = ImagePicker();
        Future getImage(ImageSource src) async {
          final pickedFile = await picker.getImage(source: src);
          setState(() {
            if (pickedFile != null) {
              image = File(pickedFile.path);
            } else {
              print("no image selected");
            }
          });
        }
      

      【讨论】:

      • 您的答案可以通过额外的支持信息得到改进。请edit 添加更多详细信息,例如引用或文档,以便其他人可以确认您的答案是正确的。你可以找到更多关于如何写好答案的信息in the help center
      猜你喜欢
      • 1970-01-01
      • 2021-04-12
      • 2018-10-12
      • 2020-10-10
      • 2020-11-29
      • 2020-02-26
      • 1970-01-01
      • 2021-02-19
      • 2021-09-06
      相关资源
      最近更新 更多