Reputation: 172
I need to initialize the Fiberbese app in a flutter routed environment
EX: I wanna use
final Future<FirebaseApp> _initialization = Firebase.initializeApp();
and after the future has completed I need to direct to the initialRoute
initialRoute:<**Replace this with a string after future returns**>,
routes: {
MyHomePage.Id :(context) => MyHomePage(),
SoundTester.Id :(context) => SoundTester(),
GoogleMapSample.Id:(context) => GoogleMapSample()
},
Is there any way to do this? or this is impossible to do?
Upvotes: 0
Views: 154
Reputation: 1313
Initialise your app in main.dart at the main() method like this
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized(); // add this line
await Firebase.initializeApp(); // add this line
runApp(MyApp());
}
Upvotes: 1