title: New Flutter App fails when adding dependency cloud_firestore: ^1.0.7
body: <p>I followed these steps to create a new flutter app and add cloud_firestore dependency</p>
  <ol>
  <li><p>I setup flutter on my MacOS Big Sur 11.2.3</p>
  </li>
  <li><p>I typed in command line: <code>flutter create test_dependencies</code></p>
  </li>
  <li><p><code>dart migrate --apply-changes</code></p>
  </li>
  <li><p><code>flutter run</code><br />
  -&gt; The app works fine as a web app. The chrome browsers opens up the app and I can use the counter</p>
  </li>
  <li><p>I run <code>flutter pub add cloud_firestore</code></p>
  </li>
  <li><p>I confirmed that cloud_firestore: ^1.0.7 was added in pubspec.yaml</p>
  </li>
  <li><p>I then updated all dependencies and index.html as shown below</p>
  </li>
  <li><p>I run <code>flutter packages get</code></p>
  </li>
  <li><p>I run <code>flutter run</code></p>
  </li>
  </ol>
  <p>Now I get this error. I actually had a larger app and I started with this simple scenario to isolate the problem. This is the simplest app I can write and it still fails. Any help will be appreciated.</p>
  <blockquote>
  <p>TypeError: Cannot read property 'app' of undefined
  at Object.app$ [as app] (http://localhost:64162/packages/firebase_core_web/src/interop/core.dart.lib.js:42:101)
  at new cloud_firestore_web.FirebaseFirestoreWeb.new (http://localhost:64162/packages/cloud_firestore_web/src/write_batch_web.dart.lib.js:865:64)
  at Function.registerWith (http://localhost:64162/packages/cloud_firestore_web/src/write_batch_web.dart.lib.js:788:73)
  at Object.registerPlugins (http://localhost:64162/packages/blackdoor/generated_plugin_registrant.dart.lib.js:33:46)
  at main (http://localhost:64162/web_entrypoint.dart.lib.js:41:35)
  at main.next ()
  at runBody (http://localhost:64162/dart_sdk.js:37228:34)
  at Object._async [as async] (http://localhost:64162/dart_sdk.js:37259:7)
  at main$ (http://localhost:64162/web_entrypoint.dart.lib.js:40:18)
  at http://localhost:64162/main_module.bootstrap.js:19:10
  at Array.forEach ()
  at window.$dartRunMain (http://localhost:64162/main_module.bootstrap.js:18:32)
  at :1:8
  at Object.runMain (http://localhost:64162/dwds/src/injected/client.js:8656:21)
  at http://localhost:64162/dwds/src/injected/client.js:22068:19
  at _wrapJsFunctionForAsync_closure.$protected (http://localhost:64162/dwds/src/injected/client.js:3830:15)
  at _wrapJsFunctionForAsync_closure.call$2 (http://localhost:64162/dwds/src/injected/client.js:10905:12)
  at Object._asyncStartSync (http://localhost:64162/dwds/src/injected/client.js:3794:20)
  at main__closure1.$call$body$main__closure (http://localhost:64162/dwds/src/injected/client.js:22080:16)
  at main__closure1.call$1 (http://localhost:64162/dwds/src/injected/client.js:22007:19)
  at StaticClosure._rootRunUnary [as call$2$5] (http://localhost:64162/dwds/src/injected/client.js:4153:16)
  at _CustomZone.runUnary$2$2 (http://localhost:64162/dwds/src/injected/client.js:12136:39)
  at _CustomZone.runUnaryGuarded$1$2 (http://localhost:64162/dwds/src/injected/client.js:12068:14)
  at _ControllerSubscription._sendData$1 (http://localhost:64162/dwds/src/injected/client.js:11697:19)
  at _DelayedData.perform$1 (http://localhost:64162/dwds/src/injected/client.js:11849:59)
  at _PendingEvents_schedule_closure.call$0 (http://localhost:64162/dwds/src/injected/client.js:11898:14)
  at Object._microtaskLoop (http://localhost:64162/dwds/src/injected/client.js:3990:24)
  at StaticClosure._startMicrotaskLoop (http://localhost:64162/dwds/src/injected/client.js:3996:11)
  at _AsyncRun__initializeScheduleImmediate_internalCallback.call$1 (http://localhost:64162/dwds/src/injected/client.js:10774:9)
  at invokeClosure (http://localhost:64162/dwds/src/injected/client.js:1250:26)
  at MutationObserver. (http://localhost:64162/dwds/src/injected/client.js:1269:18)</p>
  </blockquote>
  <p><strong>Index.html</strong></p>
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
    &lt;!--
      If you are serving your web app in a path other than the root, change the
      href value below to reflect the base path you are serving from.
      The path provided below has to start and end with a slash &quot;/&quot; in order for
      it to work correctly.
      Fore more details:
      * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base
    --&gt;
    &lt;base href=&quot;/&quot;&gt;
    &lt;meta charset=&quot;UTF-8&quot;&gt;
    &lt;meta content=&quot;IE=Edge&quot; http-equiv=&quot;X-UA-Compatible&quot;&gt;
    &lt;meta name=&quot;description&quot; content=&quot;An apiro project.&quot;&gt;
    &lt;!-- iOS meta tags &amp; icons --&gt;
    &lt;meta name=&quot;apple-mobile-web-app-capable&quot; content=&quot;yes&quot;&gt;
    &lt;meta name=&quot;apple-mobile-web-app-status-bar-style&quot; content=&quot;black&quot;&gt;
    &lt;meta name=&quot;apple-mobile-web-app-title&quot; content=&quot;blackdoor&quot;&gt;
    &lt;link rel=&quot;apple-touch-icon&quot; href=&quot;icons/Icon-192.png&quot;&gt;
    &lt;!-- Favicon --&gt;
    &lt;link rel=&quot;icon&quot; type=&quot;image/png&quot; href=&quot;favicon.png&quot;/&gt;
    &lt;title&gt;blackdoor&lt;/title&gt;
    &lt;link rel=&quot;manifest&quot; href=&quot;manifest.json&quot;&gt;
  &lt;/head&gt;
  &lt;body&gt;
    &lt;!-- This script installs service_worker.js to provide PWA functionality to
         application. For more information, see:
         https://developers.google.com/web/fundamentals/primers/service-workers --&gt;
    &lt;script&gt;
      if ('serviceWorker' in navigator) {
        window.addEventListener('flutter-first-frame', function () {
          navigator.serviceWorker.register('flutter_service_worker.js?v=1463819943');
        });
      }
    &lt;/script&gt;
    &lt;!-- The core Firebase JS SDK is always required and must be listed first --&gt;
    &lt;script src=&quot;https://www.gstatic.com/firebasejs/8.4.3/firebase-app.js&quot;&gt;&lt;/script&gt;
    &lt;script src=&quot;https://www.gstatic.com/firebasejs/8.4.3/firebase-firestore.js&quot;&gt;&lt;/script&gt;
    &lt;script src=&quot;https://www.gstatic.com/firebasejs/8.4.3/firebase-auth.js&quot;&gt;&lt;/script&gt;
    &lt;script src=&quot;https://www.gstatic.com/firebasejs/8.4.3/firebase-storage.js&quot;&gt;&lt;/script&gt;
    &lt;script src=&quot;https://www.gstatic.com/firebasejs/9.1.2/firebase-messaging.js&quot;&gt;&lt;/script&gt;
    &lt;!-- TODO: Add SDKs for Firebase products that you want to use
         https://firebase.google.com/docs/web/setup#available-libraries --&gt;
    &lt;script src=&quot;https://www.gstatic.com/firebasejs/8.4.3/firebase-analytics.js&quot;&gt;&lt;/script&gt;
    &lt;script&gt;
    // Your web app's Firebase configuration
    // For Firebase JS SDK v7.20.0 and later, measurementId is optional
    var firebaseConfig = {
      apiKey: &quot;***&quot;,
      authDomain: &quot;***&quot;,
      projectId: &quot;***&quot;,
      storageBucket: &quot;***&quot;,
      messagingSenderId: &quot;***&quot;,
      appId: &quot;***&quot;,
      measurementId: &quot;***&quot;
    };
    // Initialize Firebase
    firebase.initializeApp(firebaseConfig);
    firebase.analytics();
  &lt;/script&gt;
    &lt;script src=&quot;main.dart.js&quot; type=&quot;application/javascript&quot;&gt;&lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  <p><em><strong>pubspec.yaml</strong></em></p>
  <pre><code>name: blackdoor
  description: A new Flutter project.
  
  # The following line prevents the package from being accidentally published to
  # pub.dev using `pub publish`. This is preferred for private packages.
  publish_to: 'none' # Remove this line if you wish to publish to pub.dev
  
  # The following defines the version and build number for your application.
  # A version number is three numbers separated by dots, like 1.2.43
  # followed by an optional build number separated by a +.
  # Both the version and the builder number may be overridden in flutter
  # build by specifying --build-name and --build-number, respectively.
  # In Android, build-name is used as versionName while build-number used as versionCode.
  # Read more about Android versioning at https://developer.android.com/studio/publish/versioning
  # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
  # Read more about iOS versioning at
  # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
  version: 1.0.0+1
  
  environment:
    sdk: '&gt;=2.12.0 &lt;3.0.0'
  
  dependencies:
    flutter:
      sdk: flutter
    flutter_localizations: 
      sdk: flutter         
    provider: ^5.0.0
    intl: ^0.17.0
    http: ^0.13.1
    image_picker: ^0.7.4
  
    cloud_firestore: ^1.0.7
    cloud_firestore_web: ^1.0.7
    firebase_auth: ^1.1.2
    firebase_auth_web: ^1.1.0
    firebase_core: ^1.1.0
    firebase_core_web: ^1.0.2
    firebase_messaging: ^9.1.3
    firebase_messaging_web: ^1.0.6
    firebase_storage: ^8.0.5
    firebase_storage_web: ^1.0.5
  
    # The following adds the Cupertino Icons font to your application.
    # Use with the CupertinoIcons class for iOS style icons.
    cupertino_icons: ^1.0.2 
  
  dev_dependencies:
    flutter_test:
      sdk: flutter
  
  # For information on the generic Dart part of this file, see the
  # following page: https://dart.dev/tools/pub/pubspec
  
  # The following section is specific to Flutter.
  flutter:
    generate: true # Enable generate flag for localisation  
  
    # The following line ensures that the Material Icons font is
    # included with your application, so that you can use the icons in
    # the material Icons class.
    uses-material-design: true
  
    # To add assets to your application, add an assets section, like this:
    # assets:
    #   - images/a_dot_burr.jpeg
    #   - images/a_dot_ham.jpeg
  
    # An image asset can refer to one or more resolution-specific &quot;variants&quot;, see
    # https://flutter.dev/assets-and-images/#resolution-aware.
  
    # For details regarding adding assets from package dependencies, see
    # https://flutter.dev/assets-and-images/#from-packages
  
    # To add custom fonts to your application, add a fonts section here,
    # in this &quot;flutter&quot; section. Each entry in this list should have a
    # &quot;family&quot; key with the font family name, and a &quot;fonts&quot; key with a
    # list giving the asset and other descriptors for the font. For
    # example:
    fonts:
      - family: OpenSans
        fonts:
          - asset: assets/fonts/OpenSans-Regular.ttf
          - asset: assets/fonts/OpenSans-Bold.ttf
            weight: 700
  
      - family: Quicksand
        fonts:
          - asset: assets/fonts/Quicksand-Regular.ttf
          - asset: assets/fonts/Quicksand-Bold.ttf
            weight: 700
    #   - family: Trajan Pro
    #     fonts:
    #       - asset: fonts/TrajanPro.ttf
    #       - asset: fonts/TrajanPro_Bold.ttf
    #         weight: 700
    #
    # For details regarding fonts from package dependencies,
    # see https://flutter.dev/custom-fonts/#from-packages
  </code></pre>