uploadFromString method

Future<String> uploadFromString({
  1. required String path,
  2. required String fileUrl,
  3. PutStringFormat format = PutStringFormat.raw,
  4. SettableMetadata? metadata,
})

Uploads a file from a fileUrl string to path and returns the public download URL.

Useful for uploading files accessible via a local URI or a string path.

Throws FirebaseException on failure — handle in the provider/caller.

Implementation

Future<String> uploadFromString({
  required String path,
  required String fileUrl,
  PutStringFormat format = PutStringFormat.raw,
  SettableMetadata? metadata,
}) async {
  final UploadTask task = _ref(
    path,
  ).putString(fileUrl, format: format, metadata: metadata);
  final TaskSnapshot snapshot = await task;
  return await snapshot.ref.getDownloadURL();
}