1

I was trying to create a file in Appwrite Storage Bucket but without success.

I'm using the packages: appwrite: ^8.0.2 image_picker: ^1.0.2

the image is being collected by the image picker because I can use it in the program with Image.network() but for some reason the InputFile cannot get this path and this error occurs.

I tried every way to make it work but I couldn't.

My Code:

Storage storage = Storage(client);

image = await picker.pickImage(source: ImageSource.gallery);

if (image != null) {
  imagePath = image!.path;

  var imageInput = InputFile.fromPath(
    path: imagePath,
    filename: 'teste.png',
  );

  var result = await storage.createFile(
    bucketId: bucketId,
    fileId: ID.unique(),
    file: imageInput,
  );
}
LinkGr
  • 11
  • 2

0 Answers0