Access of global variables in dart / flutter
The underscore _
before a variable name means that the variable is private.A global variable should be a public variable, a public variable on the other hand should begin without the _
By changing "final _firestore = Firestore.instance" to "final firestore = Firestore.instance" you should be able to access your variable globally.
Another way to make your private variable to be accessed on global level is by adding a getter like this:Firestore get firestore => _firestore;