'Flutter App does not Connect to Firebase: MissingPluginException thrown

I am unable to connect my flutter iOS app to firebase. I have attempted running pub get, running flutter clean/flutter run, I have attempted creating a new project, all to no avail. I am new to flutter so apologies if I am doing something incorrect. The problem only seems to occur when I add "await Firebase.initializeApp();"

Thanks in advance and please see my main.dart, Pubspec.yaml and plist attached below. I've also attached a link to a screenshot of the error below

Link to screenshot of error

main.dart

import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:crumble/Pages/HomeScreen.dart';
import 'package:crumble/Pages/JoinScreen.dart';
import 'package:crumble/Pages/SettingsScreen.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Firebase.initializeApp();
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: MainScreen(),
    );
  }
}

Pubspec.yaml dependencies

dependencies:
  flutter:
    sdk: flutter
  modal_bottom_sheet: ^2.0.0
  firebase_core: ^1.12.0
  firebase_auth: ^3.3.7

Required Plist for Flutter Plugin

<key>NSAppTransportSecurity</key>
  <dict>
      <key>NSAllowsLocalNetworking</key>
      <true/>
  </dict>


Solution 1:[1]

I finally fixed the issue. It appeared to be an issue on the new M1 macbook's. Cocoapods needed to be installed using homebrew. Thereafter, once uninstalling, reinstalling and starting a new project the issue was resolved. Attached is a good video on how to do this.

https://www.youtube.com/watch?v=SOjSNB7F2m4

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 mlip