相关疑难解决方法(0)

如何清除Flutter的图像缓存?

Flutter有自己的内部图像缓存.我需要清除图像缓存.我怎么做?

dart flutter

19
推荐指数
2
解决办法
6626
查看次数

无法在 Flutter 中覆盖文件

  Future<Null> pickImageFromGallery() async {
    String path = (await getApplicationDocumentsDirectory()).path;
    File imageExist = new File(path + '/image1.png');
    if(await imageExist.exists()) {
      imageExist.delete();
    }

    File imageFile = await ImagePicker.pickImage(source: ImageSource.gallery);
    if(imageFile == null) return;
    File newImage = await imageFile.copy('$path/image1.png');
    setState(() {
      this.categoryIcon = newImage;
    });
  }
Run Code Online (Sandbox Code Playgroud)

我正在创建一个允许用户为项目选择图标的应用程序。我正在使用图像选择器来允许用户选择图像。当用户选择图像时,我想覆盖应用程序目录中的文件。

但是使用该代码,每次选择新图像时我都会得到相同的文件图像。好像换不了图

io android image file flutter

3
推荐指数
1
解决办法
2405
查看次数

标签 统计

flutter ×2

android ×1

dart ×1

file ×1

image ×1

io ×1