This is my code -
Future uploadImage() async {
var randomno = Random(25);
final StorageReference firebaseStorageRef = FirebaseStorage.instance
.ref()
.child('profilepics/${randomno.nextInt(5000).toString()}.jpg');
StorageUploadTask task = firebaseStorageRef.putFile(selectedImage);
task.future.then((value) {
setState(() {
userManagement
.updateProfilePic(value.downloadUrl.toString())
.then((val) {
setState(() {
profilePicUrl = value.downloadUrl.toString();
isLoading = false;
});
});
});
}).catchError((e) {
print(e);
});
}
This is the error it gives -
The getter 'future' isn't defined for the type 'StorageUploadTask'. Try importing the library that defines 'future', correcting the name to the name of an existing getter, or defining a getter or field named 'future'.
Although i have already imported dart:async and dart:io Please help, thanks