title: Flutter on iOS: Despite calling Firebase.initializeApp() on a future builder, app is not initialized
body: <p>The title says it all. Below are the relevant classes and their respective codes.</p>
  <p>main.dart</p>
  <pre><code>... //Imports
  void main() {
    runApp(MyApp());
  }
  
  class MyApp extends StatelessWidget {
    @override
    Widget build(BuildContext context) {
      return MultiProvider(
        providers: [
          ChangeNotifierProvider(create: (_) =&gt; NotificationService())
        ],
        child: MaterialApp(
          localizationsDelegates: [
            GlobalMaterialLocalizations.delegate,
          ],
          supportedLocales: [
            const Locale('en', ''),
            const Locale('pt', 'BR'),
          ],
          home: MyHomePage(),
          debugShowCheckedModeBanner: false,
        ),
      );
    }
  }
  
  class MyHomePage extends StatefulWidget {
    @override
    _MyHomePageState createState() =&gt; _MyHomePageState();
  }
  
  class _MyHomePageState extends State&lt;MyHomePage&gt; {
    @override
    Widget build(BuildContext context) {
      return Scaffold(
        body: Center(
          child: StartPage(),
        ),
      );
    }
  }
  </code></pre>
  <p>startPage.dart</p>
  <pre><code>... //Imports
  class StartPage extends StatelessWidget {
    Future&lt;void&gt; init(BuildContext context) async {
      Firebase.initializeApp(); //Firebase initialization
      await Provider.of&lt;NotificationService&gt;(context, listen: false).init();
    }
  
    @override
    Widget build(BuildContext context) {
      return FutureBuilder(
          future: init(context),
          builder: (context, snapshot) {
            if (snapshot.connectionState == ConnectionState.waiting)
              return LoadingSpinner();
            else {
              return StreamBuilder&lt;User?&gt;(
                stream: AuthService().userChanges,
                builder: (context, snapshot) {
                  if (snapshot.connectionState == ConnectionState.waiting) {
                    return LoadingSpinner();
                  } else {
                    print(snapshot.hasData);
                    return snapshot.hasData ? MainScreen() : AuthPage();
                  }
                },
              );
            }
          });
    }
  }
  </code></pre>
  <p>pubspec.yaml</p>
  <pre><code>...
  version: 1.0.0+1
  
  environment:
    sdk: &quot;&gt;=2.12.0 &lt;3.0.0&quot;
  
  dependencies:
    flutter:
      sdk: flutter
  
    cupertino_icons: ^1.0.2
    flutter_spinkit: ^5.1.0
    brasil_fields: ^1.1.4
    image_picker: ^0.8.4+2
    provider: ^6.0.0
    firebase_auth: ^3.1.1
    cloud_firestore: ^2.5.3
    firebase_storage: ^10.0.3
    firebase_core: ^1.7.0
    firebase_messaging: ^10.0.7
    flutter_typeahead: ^3.2.1
    rxdart: ^0.27.2
    table_calendar: ^3.0.2
    flutter_form_builder: ^6.1.0+1
    http: ^0.13.4
    flutter_localizations: 
      sdk: flutter
      version: ^0.0.0
  
  dev_dependencies:
    flutter_test:
      sdk: flutter
  ...
  </code></pre>
  <p>When I try to run the app on android emulator, even on an android device, it works normally. However, on the iOS emulator, it shows the following error:</p>
  <pre><code>[VERBOSE-2:ui_dart_state.cc(209)] Unhandled Exception: [core/no-app] No Firebase App '[DEFAULT]' has been created - call Firebase.initializeApp()
  </code></pre>
  <p>Even though I call Firebase.initializeApp on startPage.dart on an async method. Please help!</p>