Upload Blob Url to Firebase Storage | Flutter


So I already read about the topic but I simply didn’t understand the solutions on stack.

I came up with this code:

Im saving a url looking like this:

final String myDataUrl = file.url;


& then Im trying to add it into Firebase Storage with the putString operator, that I guessed that suited me best while reading the Documentation. I thought that I have a Url and therefore should be able to upload it like this:

      .putString(myDataUrl, format: PutStringFormat.dataUrl);

But it doesn’t work, it says that:

Error: Invalid argument (uri): Scheme must be 'data': Instance of '_Uri'

So Im guessing that it somehow can’t format my url to one that is accepted.

What can I do different to upload a blob successfully to firebase Storage?


Answer in the comment of the answer.

You have to convert your Blob to a Uint8List & upload it like:

 Future<Uint8List> fileConverter() async {
final reader = html.FileReader();
await reader.onLoad.first;
return reader.result as Uint8List;

and then put it into your Storage:

  Future uploadFile(String uid) async {
if (file == null) return;
final path = "nachweise/$uid";
Uint8List fileConverted = await fileConverter();
try {
      .then((bla) => print("sucess"));
} on FirebaseException catch (e) {
  return null;


The Firebase Storage SDKs can upload local data as either a File, an array of bytes, or a base-64 encoded string. The only URLs it accepts are so-called data URLs, which start with data:// and contain the complete data of the object. They cannot upload data directly from URLs that you more commonly see, such as http:// or https://.

You’ll need to first download the data from that URL to the local device, and then upload it from there.

Answered By – Frank van Puffelen

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published