将图像存储到应用程序的本地目录中

时间:2020-04-26 08:38:12

标签: flutter dart visual-studio-code flutter-layout flutter-dependencies

我正在尝试制作一个聊天应用程序。当发件人向我发送图像文件时,它应该转到应用程序的本地目录。在这里,我有cdz.dc之类的目录>文件>图片。我要存储下载的网络项目在这里。当我将图像发送给其他人时,它将自动添加到directiry.now。我只是尝试将图像添加到目录intrnalsorage> pictures。但是我想将其添加到应用程序的目录中。我想知道有关此的详细信息。我想了解更多。 期待很快的回复.............谢谢

这是我编写的将接收到的图像添加到内部存储>图片中的代码

    print("_onImageSaveButtonPressed");
    var response = await http.get(
      url,
    );

    debugPrint(response.statusCode.toString());

    var filePath =
        await ImagePickerSaver.saveFile(fileData: response.bodyBytes);
    print(filePath);
    var savedFile = File.fromUri(Uri.file(filePath));
    print(doc);
    if (response.statusCode.toString() == '200') {
      Firestore.instance
          .collection('messages')
          .document(doc)
          .updateData({'isDownloadedImg': true});
    }
  }```


0 个答案:

没有答案