Simba
Simba

Reputation: 5

I can't solve this error, pls help me! Error: 'StorageUploadTask' isn't a type

uploadToStorage() async { showDialog( context: context, builder: (c) { return LoadingAlertDialog(); } );

String imageFileName = DateTime.now().millisecondsSinceEpoch.toString();

StorageReference storageReference = FirebaseStorage.instance.ref().child(imageFileName);

StorageUploadTask storageUploadTask = storageReference.putFile(_imageFile);

StorageTaskSnapshot = await storageUploadTask.onComplete;

await taskSnapshot.ref.getDownloadURL().then((urlImage){
  userImageUrl = urlImage;

  _registerUser();
});

}

Upvotes: 0

Views: 295

Answers (1)

Sound Conception
Sound Conception

Reputation: 5411

If you're using the latest version of the firebase_storage package, the correct class is called UploadTask not StorageUploadTask.

See the API reference https://pub.dev/documentation/firebase_storage/latest/firebase_storage/UploadTask-class.html

Upvotes: 1

Related Questions