Future<String?> uploadImageOld () async {
FilePickerResult? result = await FilePicker.platform.pickFiles();
if (result != null) {
final storageRef = FirebaseStorage.instance.ref();
final images = storageRef.child('images');
File file = File(result.files.single.path!);
final filename = Path.basename(file.path);
final uploadRef = images.child('images/$filename');
await uploadRef.putFile(file);
return await uploadRef.getDownloadURL();
} else {
return null;
}
}
Trying to select a file and upload to firebase cloud storage, but it freeze after I select a file.
see upload-files and try below if works