uploadProfilePicture method
Implementation
Future<Reference> uploadProfilePicture(File image, String uploadDirectory,
int id, Function? imagePostProcessingFuction) async {
final String uploadPath = '$uploadDirectory${id.toString()}_800.jpg';
final Reference imgRef = _storageInstance.ref().child(uploadPath);
// start upload
final UploadTask uploadTask =
imgRef.putFile(image, new SettableMetadata(contentType: 'image/jpg'));
// wait until upload is complete
try {
await uploadTask;
} on Exception catch (error, stackTrace) {
throw Exception('Upload failed, Firebase Error: $error $stackTrace');
}
return imgRef;
}