After installing the package in your Flutter app, you need to initialize Firebase in your main function. You are probably invoking firebase before the app is initialized. All calls to firebase must come after .initializeApp(). So in your main function initialize first as shown below.
var db = firebase.firestore();
To know more, join our Flutter Development Course today.