title: Getting the URL from FirebaseStorage URI in Flutter
body: <p>Sorry for the noob question. But how do I get the Url String from a Uri ? In my understanding the Url is a subset of Uri but I couldn't find any method that says something like <code>.getUrl</code>. Did I miss anything ?</p>
  <p>Background:<br>
  The <code>getDownloadURL()</code> of FirebaseStorage in Flutter Web somehow returns <code>Uri</code> instead of <code>String</code>.</p>
  <p>The explanation from from Flutter Web's FirebaseStorage package:</p>
  <blockquote>
  <p>Future&lt;Uri&gt; getDownloadURL() package:firebase/src/storage.dart</p>
  <p>Returns a long lived download URL for this reference.</p>
  </blockquote>
  <p>The <code>getDownloadURL</code> explanation from from <strong>Flutter App's</strong> FirebaseStorage package:</p>
  <blockquote>
  <p>Future&lt;String&gt; getDownloadURL()
  package:firebase_storage/firebase_storage.dart</p>
  <p>Fetches a long lived download URL for this object.</p>
  </blockquote>
  <p>In the Flutter App my pubspec.yaml:</p>
  <pre><code>  firebase_core: ^0.5.1
    firebase_auth: ^0.18.2
    cloud_firestore: ^0.14.2
    firebase_storage: ^5.0.0-dev.4
  </code></pre>
  <p>In the Flutter Web my pubspec.yaml:</p>
  <pre><code>  firebase: ^7.3.2
    cloud_firestore: ^0.14.2
    cloud_functions: ^0.6.0+1
  </code></pre>
  <p>I tried to find solutions and read the docs but I haven't found any writing about converting the Uri to Url from Firebase Storage <code>getDownloadURL</code> method. It seems to be treated almost like the same thing. But it gave me error. See Code below:</p>
  <p>*** Code:</p>
  <pre><code>Future&lt;String&gt; uploadImage(String localFilename, String filename, String path, StorageReference ref) async {
      final byteData = await rootBundle.load('assets/posts_images/$localFilename');
      final bytes = byteData.buffer.asUint8List();
  
      final metadata = UploadMetadata(contentType: 'image/jpeg');
      final uploadTask = ref.child('$path/$filename').put(bytes, metadata); 
      final snapshot = await uploadTask.future;
      final url = await snapshot.ref.getDownloadURL();
  
      return url; // Error: A value of type 'Uri' can't be returned from method 'uploadImage' because it has a return type of 'Future&lt;String&gt;' 
    }
  </code></pre>
  <p>Thanks</p>