Describe the bug
When trying to read data from a collection (either get or snapshot), the following error is thrown:
Error: [cloud_firestore/unknown] NoSuchMethodError: invalid member on null: 'includeMetadataChanges'
at Object.throw_ [as throw] (http://localhost:5000/dart_sdk.js:4339:11)
at collection_reference_web.CollectionReferenceWeb.new.get (http://localhost:5000/packages/cloud_firestore_web/src/write_batch_web.dart.lib.js:321:21)
at get.next (<anonymous>)
at http://localhost:5000/dart_sdk.js:37679:33
at _RootZone.runUnary (http://localhost:5000/dart_sdk.js:37533:58)
at _FutureListener.thenAwait.handleValue (http://localhost:5000/dart_sdk.js:32507:29)
at handleValueCallback (http://localhost:5000/dart_sdk.js:33054:49)
at Function._propagateToListeners (http://localhost:5000/dart_sdk.js:33092:17)
at _Future.new.[_completeWithValue] (http://localhost:5000/dart_sdk.js:32935:23)
This does not occur with a single document read. This makes it impossible to use FireStore.
Steps to reproduce the behavior:
await _firestore
.collection('sampleCollection')
.get();Data is correctly read.
Currently working on v0.18.3, tried reverting to 0.18.0, but encountered the same problem. Reverting to even earlier version results in too many breaking changes.
Run flutter doctor and paste the output below:
Click To Expand
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel beta, 1.23.0-18.1.pre, on Microsoft Windows [Version 10.0.18362.1139], locale en-GB)
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[√] Chrome - develop for the web
[√] Android Studio (version 3.6)
[√] VS Code (version 1.51.1)
[√] Connected device (3 available)
• No issues found!
Run flutter pub deps -- --style=compact and paste the output below:
Click To Expand
Dart SDK 2.11.0-213.1.beta
Flutter SDK 1.23.0-18.1.pre
dependencies:
- cloud_firestore 0.14.3 [flutter meta quiver firebase_core firebase_core_platform_interface cloud_firestore_platform_interface cloud_firestore_web]
- crypto 2.1.5 [collection convert typed_data]
- cupertino_icons 1.0.0
- dio 3.0.10 [http_parser path]
- dio_flutter_transformer 3.0.2 [flutter dio]
- enum_to_string 1.0.13
- equatable 1.2.5 [collection meta]
- firebase_auth 0.18.3 [meta firebase_core firebase_core_platform_interface firebase_auth_platform_interface firebase_auth_web flutter]
- firebase_core 0.5.2 [firebase_core_platform_interface flutter quiver meta firebase_core_web]
- flutter 0.0.0 [characters collection meta typed_data vector_math sky_engine]
- get_it 5.0.1 [async meta]
- google_sign_in 4.5.5 [google_sign_in_platform_interface flutter meta google_sign_in_web]
- http 0.12.2 [http_parser path pedantic]
- injectable 1.0.5 [get_it]
- json_annotation 3.1.0
- logger 0.9.4
- pretty_dio_logger 1.1.1 [dio]
- provider 4.3.2+2 [flutter nested collection]
- retrofit 1.3.4+1 [meta dio]
- rxdart 0.24.1
- shared_preferences 0.5.12+2 [meta flutter shared_preferences_platform_interface shared_preferences_linux shared_preferences_macos shared_preferences_web shared_preferences_windows]
- stats 1.0.0 [json_annotation]
dev dependencies:
- build_runner 1.10.3 [args async build build_config build_daemon build_resolvers build_runner_core code_builder collection crypto dart_style glob graphs http_multi_server io js logging meta mime path pedantic pool pub_semver pubspec_parse shelf shelf_web_socket stack_trace stream_transform timing watcher web_socket_channel yaml]
- flutter_test 0.0.0 [flutter test_api path fake_async clock stack_trace vector_math async boolean_selector characters charcode collection matcher meta source_span stream_channel string_scanner
term_glyph typed_data]
- injectable_generator 1.0.6 [build source_gen path glob analyzer injectable collection]
- json_serializable 3.5.0 [analyzer build build_config json_annotation meta path source_gen]
- lint 1.3.0
- retrofit_generator 1.4.0 [dio source_gen built_collection code_builder tuple retrofit analyzer dart_style build]
transitive dependencies:
- _fe_analyzer_shared 11.0.0 [meta]
- analyzer 0.40.4 [_fe_analyzer_shared args charcode cli_util collection convert crypto glob meta package_config path pub_semver source_span watcher yaml]
- args 1.6.0
- async 2.5.0-nullsafety.1 [collection]
- boolean_selector 2.1.0-nullsafety.1 [source_span string_scanner]
- build 1.5.0 [analyzer async convert crypto logging meta path glob]
- build_config 0.4.2 [checked_yaml json_annotation meta path pubspec_parse yaml]
- build_daemon 2.1.4 [built_collection built_value http_multi_server logging pedantic path pool shelf shelf_web_socket stream_transform watcher web_socket_channel]
- build_resolvers 1.4.2 [analyzer build crypto graphs logging meta path package_config pool pub_semver]
- build_runner_core 6.0.3 [async build build_config build_resolvers collection convert crypto glob graphs json_annotation logging meta path package_config pedantic pool timing watcher yaml]
- built_collection 4.3.2 [collection quiver]
- built_value 7.1.0 [built_collection collection fixnum quiver]
- characters 1.1.0-nullsafety.3
- charcode 1.2.0-nullsafety.1
- checked_yaml 1.0.2 [json_annotation source_span yaml]
- cli_util 0.2.0 [path]
- clock 1.1.0-nullsafety.1
- cloud_firestore_platform_interface 2.2.0 [flutter meta collection firebase_core plugin_platform_interface]
- cloud_firestore_web 0.2.1 [flutter flutter_web_plugins http_parser meta firebase_core firebase_core_web cloud_firestore_platform_interface js]
- code_builder 3.5.0 [built_collection built_value collection matcher meta]
- collection 1.15.0-nullsafety.3
- convert 2.1.1 [charcode typed_data]
- dart_style 1.3.8 [analyzer args path source_span]
- fake_async 1.2.0-nullsafety.1 [clock collection]
- ffi 0.1.3
- file 5.2.1 [intl meta path]
- firebase_auth_platform_interface 2.1.3 [flutter meta firebase_core plugin_platform_interface]
- firebase_auth_web 0.3.2 [flutter flutter_web_plugins meta http_parser intl firebase_core firebase_core_web firebase_auth_platform_interface js]
- firebase_core_platform_interface 2.0.0 [flutter meta plugin_platform_interface quiver]
- firebase_core_web 0.2.1 [firebase_core_platform_interface flutter flutter_web_plugins meta js]
- fixnum 0.10.11
- flutter_web_plugins 0.0.0 [flutter js characters collection meta typed_data vector_math]
- glob 1.2.0 [async collection node_io path pedantic string_scanner]
- google_sign_in_platform_interface 1.1.2 [flutter meta quiver]
- google_sign_in_web 0.9.2 [google_sign_in_platform_interface flutter flutter_web_plugins meta js]
- graphs 0.2.0
- http_multi_server 2.2.0 [async]
- http_parser 3.1.4 [charcode collection source_span string_scanner typed_data]
- intl 0.16.1 [path]
- io 0.3.4 [charcode meta path string_scanner]
- js 0.6.3-nullsafety.1
- logging 0.11.4
- matcher 0.12.10-nullsafety.1 [stack_trace]
- meta 1.3.0-nullsafety.4
- mime 0.9.7
- nested 0.0.4 [flutter]
- node_interop 1.1.1 [js]
- node_io 1.1.1 [node_interop path]
- package_config 1.9.3 [path charcode]
- path 1.8.0-nullsafety.1
- path_provider_linux 0.0.1+2 [path xdg_directories path_provider_platform_interface flutter]
- path_provider_platform_interface 1.0.3 [flutter meta platform plugin_platform_interface]
- path_provider_windows 0.0.4+1 [path_provider_platform_interface meta path flutter ffi win32]
- pedantic 1.9.2 [meta]
- platform 2.2.1
- plugin_platform_interface 1.0.3 [meta]
- pool 1.4.0 [async stack_trace]
- process 3.0.13 [file intl meta path platform]
- pub_semver 1.4.4 [collection]
- pubspec_parse 0.1.5 [checked_yaml json_annotation pub_semver yaml]
- quiver 2.1.3 [matcher meta]
- shared_preferences_linux 0.0.2+2 [file flutter meta path path_provider_linux shared_preferences_platform_interface]
- shared_preferences_macos 0.0.1+10 [shared_preferences_platform_interface flutter]
- shared_preferences_platform_interface 1.0.4 [meta flutter]
- shared_preferences_web 0.1.2+7 [shared_preferences_platform_interface flutter flutter_web_plugins meta]
- shared_preferences_windows 0.0.1+1 [shared_preferences_platform_interface flutter ffi file meta path path_provider_platform_interface path_provider_windows]
- shelf 0.7.9 [async collection http_parser path stack_trace stream_channel]
- shelf_web_socket 0.2.3 [shelf web_socket_channel stream_channel]
- sky_engine 0.0.99
- source_gen 0.9.7+1 [analyzer async build dart_style glob meta path pedantic source_span]
- source_span 1.8.0-nullsafety.2 [charcode collection path term_glyph]
- stack_trace 1.10.0-nullsafety.2 [path]
- stream_channel 2.1.0-nullsafety.1 [async]
- stream_transform 1.2.0
- string_scanner 1.1.0-nullsafety.1 [charcode source_span]
- term_glyph 1.2.0-nullsafety.1
- test_api 0.2.19-nullsafety.2 [async boolean_selector collection meta path source_span stack_trace stream_channel string_scanner term_glyph matcher]
- timing 0.1.1+2 [json_annotation]
- tuple 1.0.3 [quiver]
- typed_data 1.3.0-nullsafety.3 [collection]
- vector_math 2.1.0-nullsafety.3
- watcher 0.9.7+15 [async path pedantic]
- web_socket_channel 1.1.0 [async crypto stream_channel]
- win32 1.7.3 [ffi]
- xdg_directories 0.1.2 [meta path process]
- yaml 2.2.1 [charcode collection string_scanner source_span]
I am having this issue as well. Only happens on web (Android and iOS work fine with same code). Running latest flutter beta (1.23.0-18.1.pre) and Cloud Firestore package (0.14.3). Also reported today by another user here: https://stackoverflow.com/questions/64843311/flutter-snapshot-data-always-null
same issue, does anybody has a workarround at this point?
I switched to the prev versions of the main firebase packages and that fixes the issue. Now using these 3 versions released on Oct 29:
firebase_core: 0.5.1
firebase_auth: 0.18.2
cloud_firestore: 0.14.2
exactly same issue, only works on Android/iOS, doesn't work on Flutter Web.
I'm not seeing this with
firebase_core: ^0.5.2
cloud_firestore: ^0.14.3
on the latest master 1.24.0-8.0.pre.252.
flutter doctor -v
[√] Flutter (Channel master, 1.24.0-8.0.pre.252, on Microsoft Windows [Version 10.0.19041.572], locale et-EE)
• Flutter version 1.24.0-8.0.pre.252 at C:\Development\flutter_master
• Framework revision bf2c9dfc05 (32 hours ago), 2020-11-14 22:38:02 -0500
• Engine revision 3e77d854a7
• Dart version 2.12.0 (build 2.12.0-45.0.dev)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
• Android SDK at C:\Users\marku\AppData\Local\Android\sdk
• Platform android-30, build-tools 30.0.2
• Java binary at: C:\Users\marku\AppData\Local\JetBrains\Toolbox\apps\AndroidStudio\ch-0\201.6953283\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.7.7)
• Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
• Visual Studio Community 2019 version 16.7.30621.155
• Windows 10 SDK version 10.0.18362.0
[√] Android Studio (version 4.1.0)
• Android Studio at C:\Users\marku\AppData\Local\JetBrains\Toolbox\apps\AndroidStudio\ch-0\201.6953283
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
[√] IntelliJ IDEA Ultimate Edition (version 2020.2)
• IntelliJ at C:\Users\marku\AppData\Local\JetBrains\Toolbox\apps\IDEA-U\ch-0\202.7660.26
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
[√] Connected device (5 available)
• SM G950F (mobile) • ce12171c51cc001c03 • android-arm64 • Android 9 (API 28)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19041.572]
• Web Server (web) • web-server • web-javascript • Flutter Tools
• Chrome (web) • chrome • web-javascript • Google Chrome 86.0.4240.193
• Edge (web) • edge • web-javascript • Microsoft Edge 86.0.622.68
• No issues found!
Could any of you please provide a minimal complete reproducible code sample where you also create the test collection with the document(s) that causes the issue?
There are a few document-specific issues out there (for example if the collection contains https://github.com/FirebaseExtended/flutterfire/issues/4103 you will get that error on .collection().get()).
I tried switching to the master channel, but the issue persists.
You can reproduce it with the following sample project: https://github.com/DelcoigneYves/firestore-issue
I created a new Firebase project as well, where my firestore database looks like this:

Based on @fredecodes ' comment, I played around with the versions a bit, and can confirm the issue does not occur when downgrading firebase_core to 0.5.1.
I was getting this same issue. I did not downgrade my firebase core in the pubspec.yaml, but instead I replaced the version in my index.html and I don't see the error anymore, so I can confirm this is an issue with the latest version of the package.
NOT working:
<script src="https://www.gstatic.com/firebasejs/8.0.2/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/8.0.2/firebase-analytics.js"></script>
<script src="https://www.gstatic.com/firebasejs/8.0.2/firebase-firestore.js"></script>
Working:
<script src="https://www.gstatic.com/firebasejs/8.0.2/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/8.0.2/firebase-analytics.js"></script>
<script src="https://www.gstatic.com/firebasejs/7.20.0/firebase-firestore.js"></script>
Notice how I had to replace the version 8.0.2 with 7.20.0 for firebase-firestore.js for it to work properly.
My pubspec.yaml contains the following:
firebase_core: ^0.5.2
cloud_firestore: ^0.14.3
Reproducible on the latest master 1.24.0-8.0.pre.268 with
<script src="https://www.gstatic.com/firebasejs/8.0.2/firebase-firestore.js"></script>
but not with
<script src="https://www.gstatic.com/firebasejs/7.20.0/firebase-firestore.js"></script>
(which is still recommended at the official setup guide)
flutter doctor -v
[√] Flutter (Channel master, 1.24.0-8.0.pre.268, on Microsoft Windows [Version 10.0.19041.630], locale et-EE)
• Flutter version 1.24.0-8.0.pre.268 at C:\Development\flutter_master
• Framework revision e803b13f01 (30 minutes ago), 2020-11-16 22:55:59 -0800
• Engine revision f0e80100f7
• Dart version 2.12.0 (build 2.12.0-49.0.dev)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
• Android SDK at C:\Users\marku\AppData\Local\Android\sdk
• Platform android-30, build-tools 30.0.2
• Java binary at: C:\Users\marku\AppData\Local\JetBrains\Toolbox\apps\AndroidStudio\ch-0\201.6953283\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.7.7)
• Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
• Visual Studio Community 2019 version 16.7.30621.155
• Windows 10 SDK version 10.0.18362.0
[√] Android Studio (version 4.1.0)
• Android Studio at C:\Users\marku\AppData\Local\JetBrains\Toolbox\apps\AndroidStudio\ch-0\201.6953283
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
[√] IntelliJ IDEA Ultimate Edition (version 2020.2)
• IntelliJ at C:\Users\marku\AppData\Local\JetBrains\Toolbox\apps\IDEA-U\ch-0\202.7660.26
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
[√] Connected device (4 available)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19041.630]
• Web Server (web) • web-server • web-javascript • Flutter Tools
• Chrome (web) • chrome • web-javascript • Google Chrome 86.0.4240.198
• Edge (web) • edge • web-javascript • Microsoft Edge 86.0.622.68
• No issues found!
I am having this issue even when changing firebase-firestore.js to 7.20.0. Currently using the following:
<script src="https://www.gstatic.com/firebasejs/8.1.1/firebase-app.js"></script>
<script defer src="https://www.gstatic.com/firebasejs/8.1.1/firebase-auth.js"></script>
<script defer src="https://www.gstatic.com/firebasejs/8.1.1/firebase-firestore.js"></script>
The Function
Stream<List<Contact>> getAllContactsStream() {
return _contactsRef
.orderBy('name', descending: false)
.snapshots(includeMetadataChanges: true)
.map((snapshot) => snapshot.docs.map((document) => Contact.fromFirestore(document)).toList());
}
Error (only on Web, not iOS or Android):
Error: [cloud_firestore/unknown] NoSuchMethodError: invalid member on null: 'includeMetadataChanges'
Stack:
Stack: dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 216:49 throw_
packages/cloud_firestore_web/src/query_web.dart 161:7 <fn>
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 324:14 _checkAndCall
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 329:39 dcall
dart-sdk/lib/async/async_error.dart 16:24 _invokeErrorHandler
dart-sdk/lib/async/stream_pipe.dart 282:9 [_handleError]
dart-sdk/lib/async/stream_pipe.dart 161:13 [_handleError]
dart-sdk/lib/async/zone.dart 1396:10 runBinaryGuarded
dart-sdk/lib/async/stream_impl.dart 376:15 sendError
dart-sdk/lib/async/stream_impl.dart 394:16 [_sendError]
dart-sdk/lib/async/stream_impl.dart 294:7 [_addError]
dart-sdk/lib/async/stream_pipe.dart 132:11 [_addError]
dart-sdk/lib/async/stream_pipe.dart 180:7 _addErrorWithReplacement
dart-sdk/lib/async/stream_pipe.dart 221:7 [_handleData]
dart-sdk/lib/async/stream_pipe.dart 157:13 [_handleData]
dart-sdk/lib/async/zone.dart 1384:10 runUnaryGuarded
dart-sdk/lib/async/stream_impl.dart 357:11 [_sendData]
dart-sdk/lib/async/stream_impl.dart 285:7 [_add]
dart-sdk/lib/async/broadcast_stream_controller.dart 385:24 [_sendData]
dart-sdk/lib/async/broadcast_stream_controller.dart 250:5 add
packages/cloud_firestore_web/src/interop/firestore.dart 283:17 <fn>
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 324:14 _checkAndCall
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 329:39 dcall
https://www.gstatic.com/firebasejs/8.1.1/firebase-firestore.js 1:283936 next
https://www.gstatic.com/firebasejs/8.1.1/firebase-firestore.js 1:243227 next
https://www.gstatic.com/firebasejs/8.1.1/firebase-firestore.js 1:225309 <fn>
Pubspec:
dependencies:
flutter:
sdk: flutter
freezed_annotation: ^0.12.0
firebase_core: ^0.5.2
cloud_firestore: ^0.14.3
firebase_auth: ^0.18.3
flutter_riverpod: ^0.12.1
dev_dependencies:
flutter_test:
sdk: flutter
freezed: ^0.12.3
json_serializable: ^3.5.0
build_runner: ^1.10.6
Doctor Output
[✓] Flutter (Channel beta, 1.24.0-10.2.pre, on Mac OS X 10.15.7 19H15 darwin-x64, locale en-US)
• Flutter version 1.24.0-10.2.pre at /Users/matt/development/flutter
• Framework revision 022b333a08 (4 days ago), 2020-11-18 11:35:09 -0800
• Engine revision 07c1eed46b
• Dart version 2.12.0 (build 2.12.0-29.10.beta)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.0-rc2)
• Android SDK at /Users/matt/Library/Android/sdk
• Platform android-30, build-tools 30.0.0-rc2
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 12.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.1, Build version 12A7403
• CocoaPods version 1.10.0
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 4.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
[✓] VS Code (version 1.51.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.16.0
[✓] Connected device (4 available)
• AOSP on IA Emulator (mobile) • emulator-5554 • android-x86 • Android 9 (API 28) (emulator)
• iPhone 12 Pro Max (mobile) • 2621663E-CFBB-469A-9BD9-44B6D2AF4C14 • ios • com.apple.CoreSimulator.SimRuntime.iOS-14-1 (simulator)
• Web Server (web) • web-server • web-javascript • Flutter Tools
• Chrome (web) • chrome • web-javascript • Google Chrome 86.0.4240.198
• No issues found!
Notice how I had to replace the version 8.0.2 with 7.20.0 for firebase-firestore.js for it to work properly.
Thanks @tapizquent, this saved me! To clarify, you do not need to change the version in the pubspec.yaml for this to work.
Notice how I had to replace the version 8.0.2 with 7.20.0 for firebase-firestore.js for it to work properly.
Thanks @tapizquent, this saved me! To clarify, you do not need to change the version in the
pubspec.yamlfor this to work.
Thks, helped me, too.
@mdrideout : also had to change the other versions in index.html from 8.1.1 to 8.0.2
I was getting this same issue. I did not downgrade my firebase core in the
pubspec.yaml, but instead I replaced the version in myindex.htmland I don't see the error anymore, so I can confirm this is an issue with the latest version of the package.NOT working:
<script src="https://www.gstatic.com/firebasejs/8.0.2/firebase-app.js"></script> <script src="https://www.gstatic.com/firebasejs/8.0.2/firebase-analytics.js"></script> <script src="https://www.gstatic.com/firebasejs/8.0.2/firebase-firestore.js"></script>Working:
<script src="https://www.gstatic.com/firebasejs/8.0.2/firebase-app.js"></script> <script src="https://www.gstatic.com/firebasejs/8.0.2/firebase-analytics.js"></script> <script src="https://www.gstatic.com/firebasejs/7.20.0/firebase-firestore.js"></script>Notice how I had to replace the version
8.0.2with7.20.0forfirebase-firestore.jsfor it to work properly.My
pubspec.yamlcontains the following:firebase_core: ^0.5.2 cloud_firestore: ^0.14.3
I was facing the same problem, Thank you for the solution
I am having this issue even when changing firebase-firestore.js to 7.20.0. Currently using the following:
<script src="https://www.gstatic.com/firebasejs/8.1.1/firebase-app.js"></script> <script defer src="https://www.gstatic.com/firebasejs/8.1.1/firebase-auth.js"></script> <script defer src="https://www.gstatic.com/firebasejs/8.1.1/firebase-firestore.js"></script>The Function
Stream<List<Contact>> getAllContactsStream() { return _contactsRef .orderBy('name', descending: false) .snapshots(includeMetadataChanges: true) .map((snapshot) => snapshot.docs.map((document) => Contact.fromFirestore(document)).toList()); }Error (only on Web, not iOS or Android):
Error: [cloud_firestore/unknown] NoSuchMethodError: invalid member on null: 'includeMetadataChanges'Stack:
Stack: dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 216:49 throw_ packages/cloud_firestore_web/src/query_web.dart 161:7 <fn> dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 324:14 _checkAndCall dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 329:39 dcall dart-sdk/lib/async/async_error.dart 16:24 _invokeErrorHandler dart-sdk/lib/async/stream_pipe.dart 282:9 [_handleError] dart-sdk/lib/async/stream_pipe.dart 161:13 [_handleError] dart-sdk/lib/async/zone.dart 1396:10 runBinaryGuarded dart-sdk/lib/async/stream_impl.dart 376:15 sendError dart-sdk/lib/async/stream_impl.dart 394:16 [_sendError] dart-sdk/lib/async/stream_impl.dart 294:7 [_addError] dart-sdk/lib/async/stream_pipe.dart 132:11 [_addError] dart-sdk/lib/async/stream_pipe.dart 180:7 _addErrorWithReplacement dart-sdk/lib/async/stream_pipe.dart 221:7 [_handleData] dart-sdk/lib/async/stream_pipe.dart 157:13 [_handleData] dart-sdk/lib/async/zone.dart 1384:10 runUnaryGuarded dart-sdk/lib/async/stream_impl.dart 357:11 [_sendData] dart-sdk/lib/async/stream_impl.dart 285:7 [_add] dart-sdk/lib/async/broadcast_stream_controller.dart 385:24 [_sendData] dart-sdk/lib/async/broadcast_stream_controller.dart 250:5 add packages/cloud_firestore_web/src/interop/firestore.dart 283:17 <fn> dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 324:14 _checkAndCall dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 329:39 dcall https://www.gstatic.com/firebasejs/8.1.1/firebase-firestore.js 1:283936 next https://www.gstatic.com/firebasejs/8.1.1/firebase-firestore.js 1:243227 next https://www.gstatic.com/firebasejs/8.1.1/firebase-firestore.js 1:225309 <fn>Pubspec:
dependencies: flutter: sdk: flutter freezed_annotation: ^0.12.0 firebase_core: ^0.5.2 cloud_firestore: ^0.14.3 firebase_auth: ^0.18.3 flutter_riverpod: ^0.12.1 dev_dependencies: flutter_test: sdk: flutter freezed: ^0.12.3 json_serializable: ^3.5.0 build_runner: ^1.10.6Doctor Output
[✓] Flutter (Channel beta, 1.24.0-10.2.pre, on Mac OS X 10.15.7 19H15 darwin-x64, locale en-US) • Flutter version 1.24.0-10.2.pre at /Users/matt/development/flutter • Framework revision 022b333a08 (4 days ago), 2020-11-18 11:35:09 -0800 • Engine revision 07c1eed46b • Dart version 2.12.0 (build 2.12.0-29.10.beta) [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.0-rc2) • Android SDK at /Users/matt/Library/Android/sdk • Platform android-30, build-tools 30.0.0-rc2 • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 12.1) • Xcode at /Applications/Xcode.app/Contents/Developer • Xcode 12.1, Build version 12A7403 • CocoaPods version 1.10.0 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 4.1) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495) [✓] VS Code (version 1.51.1) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.16.0 [✓] Connected device (4 available) • AOSP on IA Emulator (mobile) • emulator-5554 • android-x86 • Android 9 (API 28) (emulator) • iPhone 12 Pro Max (mobile) • 2621663E-CFBB-469A-9BD9-44B6D2AF4C14 • ios • com.apple.CoreSimulator.SimRuntime.iOS-14-1 (simulator) • Web Server (web) • web-server • web-javascript • Flutter Tools • Chrome (web) • chrome • web-javascript • Google Chrome 86.0.4240.198 • No issues found!
Try to change your query to
List.from(snapshot.docs.map((document) => Contact.fromFirestore(document))
instead of toList()
please help me guys i did what you said but i am still having the problem
please help me guys i did what you said but i am still having the problem
Can you debug your app on mobile?, because web exceptions are misleading, it showed me this exception while I had another problem in my query code
Most helpful comment
I was getting this same issue. I did not downgrade my firebase core in the
pubspec.yaml, but instead I replaced the version in myindex.htmland I don't see the error anymore, so I can confirm this is an issue with the latest version of the package.NOT working:
Working:
Notice how I had to replace the version
8.0.2with7.20.0forfirebase-firestore.jsfor it to work properly.My
pubspec.yamlcontains the following: