Reputation: 15
I am trying to upload an Image using ImagePicker to CloudStorage but for some reason UploadTask is being stated as undefinied.
Am I missing something here or it's just the frequent updates to firebase features that got me lost here?
import 'package:firebase_storage/firebase_storage.dart' as FirebaseStorage;
FlatButton(
child: Text(
'Submit',
),
onPressed: () async {
FirebaseStorage.FirebaseStorage storage =
FirebaseStorage.FirebaseStorage.instance;
FirebaseStorage.Reference refer = storage.ref(filePath);
final File _myImage = File(_image.path);
await refer.putFile(_myImage);
*UploadTask uploadTask = refer.putFile(_myImage);*
},
),
Upvotes: 0
Views: 953
Reputation: 317497
If you imported as "FirebaseStorage", then you need to use that identifier to declare your objects, as you see in the documentation.
FirebaseStorage.UploadTask uploadTask = refer.putFile(_myImage);
Upvotes: 1