dart.io is not supported for web, and universal.io's File doesn't work when assigning arguments

756 Views Asked by At

I am making a website and would like files to be uploaded to Firebase Cloud Storage. The issue is, FirebaseStorage.instance.ref().child().putfile() takes in a File, which is from dart.io (apparently not supported for web). I tried using universal.io, but I get a type mismatch error.

To reproduce, just make a web project with cloud storage and try to putfile.

Any solutions would be appreciated

1

There are 1 best solutions below

6
Kaushik Chandru On

For flutter web you can use putdata instead of putfile

putData(
            file.bytes,
            SettableMetadata(contentType: 'image/${file.extension}'),
          );