Flutter comment charger une fonction future dans la fonction principale

Add this:

WidgetsFlutterBinding.ensureInitialized();
Before every single future functions in your main function

Example:
void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await FutureFunction();

  runApp(
    MaterialApp(
      home: MyApp(),
    ),
  );
}
Solo developer