dart.global.firebase.storage is null


I initialize firebase in the main method as such

void main() {

      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:


But, I’m getting a null pointer:

EXCEPTION: NoSuchMethodError: tried to call a non-function, such as null: 'dart.global.firebase.storage'
packages/firebase/src/top_level.ddc.js 64:100                                       storage


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

Answered By – Ted Sander

Answer Checked By – Cary Denson (FlutterFixes Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *