Reputation: 273
I initialize firebase in the main method as such
void main() {
fb.initializeApp(
apiKey: "123",
authDomain: "123",
databaseURL: "123",
projectId: "123",
storageBucket: "123",
messagingSenderId: "123");
runApp(ng.AppComponentNgFactory, createInjector: injector);
}
Then in a component, I import firebase:
import 'package:firebase/firebase.dart' as fb;
Finally I try to use storage:
fb.storage();
But, I'm getting a null pointer:
EXCEPTION: NoSuchMethodError: tried to call a non-function, such as null: 'dart.global.firebase.storage'
STACKTRACE:
packages/firebase/src/top_level.ddc.js 64:100 storage
Upvotes: 1
Views: 1064
Reputation: 1899
Looking at the firebase dart package documentation it looks like you need to add an additional script if you want to use storage.
See: https://pub.dartlang.org/documentation/firebase/latest/#do-you-need-to-use-firestore
Upvotes: 1