The class 'FirebaseStorage' doesn't have an unnamed constructor
211
According to the documentation Doug linked, creating a FirebaseStorage
object for a specific bucket is done with:
firebase_storage.FirebaseStorage storage =
firebase_storage.FirebaseStorage.instanceFor(
bucket: 'secondary-storage-bucket');
Author by
user14845003
Updated on January 04, 2023Comments
-
user14845003 over 1 year
i've cloned a git to build an app. In the storage section i've the following code:
class StorageRepo { FirebaseStorage storage = FirebaseStorage( storageBucket: '' );
However it give me the error:
The class 'FirebaseStorage' doesn't have an unnamed constructor.
What's wrong?
-
user14845003 about 2 yearsThis is what i've added for the storage, not what i've copied!
-
-
user14845003 about 2 yearsi've read that and tryied... but i get the error "Undefined name 'firebase_storage'
-
Frank van Puffelen about 2 yearsMy guess is that you're import looks different than the one in that same documentation page then:
import 'package:firebase_storage/firebase_storage.dart' as firebase_storage;
. If you just usedimport 'package:firebase_storage/firebase_storage.dart'
, you can also drop thefirebase_storage
from the class and constructor references in your code.