How to check file upload is success complete or not by using `_.writeAsBytes()`?

137 Views Asked by At

I am using the function below to upload a file.

File fileResult = await file.writeAsBytes(byte, mode: FileMode.append);

I test 2 cases by

  1. Uploaded 1.png in the empty folder.
  2. Uploaded 1.png in the folder that already has 1.png.

These results are the same! But case 2 can't upload because this file name already exists and I use the FileMode.append method. The fileResult.isAbsolute is always false I don't know why.

I can check by using the await file.exists() before uploading or using a unique file name. But I want to know how to check the upload by using _.writeAsBytes() is a success or not.

0

There are 0 best solutions below