uploadToFirebaseStorage static method
Uploads a single image to Firebase Storage and returns its download URL.
Compresses the image before uploading.
Calls onError
in case of an error.
Implementation
static Future<String?> uploadToFirebaseStorage({
required String storagePath,
Size compressSize = const Size(720, 1280),
required String filepath,
required void Function(String e) onError,
}) async {
try {
final imageList = await uploadMultipleToFirebaseStorage(
storagePath: storagePath,
filepathList: [filepath],
onError: onError,
);
return imageList.first;
} on Exception catch (e) {
onError(e.toString());
return null;
}
}