Closed nitroplr closed 2 years ago
transaction.update(auctionRef, { 'biddersMap.${bidder.userId}': bidder.toJson(), 'bidderIds': FieldValue.arrayUnion([bidder.userId]) });
@nitroplr Can you try to put this code block in try catch
and run in --release
mode and see if you get any error ? Something like below:
try {
transaction.update(auctionRef, {
'biddersMap.${bidder.userId}': bidder.toJson(),
'bidderIds': FieldValue.arrayUnion([bidder.userId])
});
} catch (e) {
showDialog(
context: context,
builder: (context) {
return SimpleDialog(
children: [
Text(e.toString())
],
);
}
);
}
This error gets thrown in release mode and not in debug mode running the same code.
Here is a little bit more info by showing a snackbar in my onError for this transaction.
Thanks. That's what I wanted to confirm if you are getting that error or not. So, you are hitting https://github.com/firebase/flutterfire/issues/9265 which has been fixed as of yesterday. So upgrade plugin to latest version to see it working properly now.
Closing, as duplicate and already fixed.
Thank you very much!
am still getting the Error saying No such method, is FieldValue.arrayUnion is removed permanently or what for flutter Web?, it's working in debug mode, but not in release mode which it should, anyone please help, it's not a valid solution to fetch data and update manually by ouselves as these are large data fields
This is working fine for me in both cloud_firestore: 3.4.3 and 3.4.4 after having just ran flutter pub upgrade.
Bug report
Describe the bug FieldValue.arrayUnion works perfectly fine when using my Android emulator and Chrome emulator in my flutter app. However, once the app is deployed to Firebase hosting, every single FieldValue.arrayUnion update in my app fails whether it is in a transaction or not. Some of this code has been working for over a year.
Steps to reproduce
Steps to reproduce the behavior:
Additional context
This is very hard for me to debug since FieldValue.arrayUnion works perfectly fine throughout my app on my emulators both Web and Android. However, they all fail once the app is deployed using: flutter build web and firebase deploy --only hosting
Broken Code Example:
Fixed with:
Flutter doctor
Run
flutter doctor
and paste the output below:Click To Expand
``` [β] Flutter (Channel stable, 3.0.5, on Microsoft Windows [Version 10.0.19044.1826], locale en-US) β’ Flutter version 3.0.5 at C:\Users\nitro\flutter β’ Upstream repository https://github.com/flutter/flutter.git β’ Framework revision f1875d570e (3 weeks ago), 2022-07-13 11:24:16 -0700 β’ Engine revision e85ea0e79c β’ Dart version 2.17.6 β’ DevTools version 2.12.2 [β] Android toolchain - develop for Android devices (Android SDK version 31.0.0-rc3) β’ Android SDK at C:\Users\nitro\AppData\Local\Android\Sdk β’ Platform android-31, build-tools 31.0.0-rc3 β’ ANDROID_HOME = C:\Users\nitro\AppData\Local\Android\Sdk β’ Java binary at: C:\Users\nitro\AppData\Local\JetBrains\Toolbox\apps\AndroidStudio\ch-0\212.5712.43.2112.8512546\jre\bin\java β’ Java version OpenJDK Runtime Environment (build 11.0.12+7-b1504.28-7817840) β’ All Android licenses accepted. [β] Chrome - develop for the web β’ Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe [β] Visual Studio - develop for Windows (Visual Studio Build Tools 2019 16.11.17) β’ Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools β’ Visual Studio Build Tools 2019 version 16.11.32630.194 β’ Windows 10 SDK version 10.0.19041.0 [β] Android Studio (version 2021.2) β’ Android Studio at C:\Users\nitro\AppData\Local\JetBrains\Toolbox\apps\AndroidStudio\ch-0\212.5712.43.2112.8512546 β’ Flutter plugin version 66.0.1 β’ Dart plugin version 211.7817 β’ Java version OpenJDK Runtime Environment (build 11.0.12+7-b1504.28-7817840) [β] IntelliJ IDEA Ultimate Edition (version 2022.1) β’ IntelliJ at C:\Users\nitro\AppData\Local\JetBrains\Toolbox\apps\IDEA-U\ch-0\221.6008.13 β’ Flutter plugin version 69.0.4 β’ Dart plugin version 221.6008.13 [β] Connected device (4 available) β’ sdk gphone x86 (mobile) β’ emulator-5554 β’ android-x86 β’ Android 11 (API 30) (emulator) β’ Windows (desktop) β’ windows β’ windows-x64 β’ Microsoft Windows [Version 10.0.19044.1826] β’ Chrome (web) β’ chrome β’ web-javascript β’ Google Chrome 103.0.5060.134 β’ Edge (web) β’ edge β’ web-javascript β’ Microsoft Edge 102.0.1245.44 [β] HTTP Host Availability β’ All required HTTP hosts are available β’ No issues found! ```Flutter dependencies
Run
flutter pub deps -- --style=compact
and paste the output below:Click To Expand
``` Dart SDK 2.17.6 Flutter SDK 3.0.5 raid_builder 1.0.0+1 dependencies: - assets_audio_player 3.0.5 [flutter rxdart uuid http path_provider assets_audio_player_web] - cloud_firestore 3.4.2 [cloud_firestore_platform_interface cloud_firestore_web collection firebase_core firebase_core_platform_interface flutter meta] - cloud_firestore_web 2.8.2 [cloud_firestore_platform_interface collection firebase_core firebase_core_web flutter flutter_web_plugins js ] - cupertino_icons 1.0.5 - equatable 2.0.3 [collection meta] - firebase_auth 3.6.1 [firebase_auth_platform_interface firebase_auth_web firebase_core firebase_core_platform_interface flutter meta] - firebase_core 1.20.0 [firebase_core_platform_interface firebase_core_web flutter meta] - firebase_storage 10.3.4 [firebase_core firebase_core_platform_interface firebase_storage_platform_interface firebase_storage_web flutte r] - flutter 0.0.0 [characters collection material_color_utilities meta vector_math sky_engine] - flutter_countdown_timer 4.1.0 [flutter] - flutter_datetime_picker 1.5.1 [flutter] - flutter_riverpod 1.0.4 [collection flutter meta riverpod state_notifier] - intl 0.17.0 [clock path] - json_annotation 4.6.0 [meta] - scrollable_positioned_list 0.3.2 [flutter collection] - url_launcher 6.1.5 [flutter url_launcher_android url_launcher_ios url_launcher_linux url_launcher_macos url_launcher_platform_interface url_launcher_web url_launcher_windows] - uuid 3.0.6 [crypto] dev dependencies: - build_runner 2.2.0 [args async analyzer build build_config build_daemon build_resolvers build_runner_core code_builder collection crypt o dart_style frontend_server_client glob graphs http_multi_server io js logging meta mime package_config path pool pub_semver pubspec_par se shelf shelf_web_socket stack_trace stream_transform timing watcher web_socket_channel yaml] - flutter_launcher_icons 0.9.3 [args image path yaml] - flutter_lints 2.0.1 [lints] - flutter_test 0.0.0 [flutter test_api path fake_async clock stack_trace vector_math async boolean_selector characters charcode collectio n matcher material_color_utilities meta source_span stream_channel string_scanner term_glyph] - json_serializable 6.3.1 [analyzer async build build_config collection json_annotation meta path pub_semver pubspec_parse source_gen sou rce_helper] transitive dependencies: - _fe_analyzer_shared 43.0.0 [meta] - analyzer 4.3.1 [_fe_analyzer_shared collection convert crypto glob meta package_config path pub_semver source_span watcher yaml] - archive 3.3.1 [crypto path] - args 2.3.1 - assets_audio_player_web 3.0.5 [flutter flutter_web_plugins] - async 2.8.2 [collection meta] - boolean_selector 2.1.0 [source_span string_scanner] - build 2.3.0 [analyzer async convert crypto glob logging meta path] - build_config 1.1.0 [checked_yaml json_annotation path pubspec_parse yaml] - build_daemon 3.1.0 [built_collection built_value http_multi_server logging path pool shelf shelf_web_socket stream_transform watcher we b_socket_channel] - build_resolvers 2.0.9 [analyzer async build crypto graphs logging path package_config pool pub_semver stream_transform yaml] - build_runner_core 7.2.3 [async build build_config build_resolvers collection convert crypto glob graphs json_annotation logging meta pa th package_config pool timing watcher yaml] - built_collection 5.1.1 - built_value 8.4.0 [built_collection collection fixnum meta] - characters 1.2.0 - charcode 1.3.1 - checked_yaml 2.0.1 [json_annotation source_span yaml] - clock 1.1.0 - cloud_firestore_platform_interface 5.7.0 [collection firebase_core flutter meta plugin_platform_interface] - code_builder 4.2.0 [built_collection built_value collection matcher meta] - collection 1.16.0 - convert 3.0.2 [typed_data] - crypto 3.0.2 [typed_data] - dart_style 2.2.3 [analyzer args path pub_semver source_span] - fake_async 1.3.0 [clock collection] - ffi 2.0.1 - file 6.1.2 [meta path] - firebase_auth_platform_interface 6.5.1 [collection firebase_core flutter meta plugin_platform_interface] - firebase_auth_web 4.2.1 [firebase_auth_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins http_parser intl js meta] - firebase_core_platform_interface 4.5.0 [collection flutter flutter_test meta plugin_platform_interface] - firebase_core_web 1.7.1 [firebase_core_platform_interface flutter flutter_web_plugins js meta] - firebase_storage_platform_interface 4.1.12 [collection firebase_core flutter meta plugin_platform_interface] - firebase_storage_web 3.3.2 [async firebase_core firebase_core_web firebase_storage_platform_interface flutter flutter_web_plugins http js meta] - fixnum 1.0.1 - flutter_web_plugins 0.0.0 [flutter js characters collection material_color_utilities meta vector_math] - frontend_server_client 2.1.3 [async path] - glob 2.1.0 [async collection file path string_scanner] - graphs 2.1.0 [collection] - http 0.13.4 [async http_parser meta path] - http_multi_server 3.2.1 [async] - http_parser 4.0.1 [collection source_span string_scanner typed_data] - image 3.2.0 [archive meta xml] - io 1.0.3 [meta path string_scanner] - js 0.6.4 - lints 2.0.0 - logging 1.0.2 - matcher 0.12.11 [stack_trace] - material_color_utilities 0.1.4 - meta 1.7.0 - mime 1.0.2 - package_config 2.1.0 [path] - path 1.8.1 - path_provider 2.0.11 [flutter path_provider_android path_provider_ios path_provider_linux path_provider_macos path_provider_platform_in terface path_provider_windows] - path_provider_android 2.0.17 [flutter path_provider_platform_interface] - path_provider_ios 2.0.11 [flutter path_provider_platform_interface] - path_provider_linux 2.1.7 [ffi flutter path path_provider_platform_interface xdg_directories] - path_provider_macos 2.0.6 [flutter path_provider_platform_interface] - path_provider_platform_interface 2.0.4 [flutter platform plugin_platform_interface] - path_provider_windows 2.1.0 [ffi flutter path path_provider_platform_interface win32] - petitparser 5.0.0 [meta] - platform 3.1.0 - plugin_platform_interface 2.1.2 [meta] - pool 1.5.1 [async stack_trace] - process 4.2.4 [file path platform] - pub_semver 2.1.1 [collection meta] - pubspec_parse 1.2.0 [checked_yaml collection json_annotation pub_semver yaml] - riverpod 1.0.3 [collection meta state_notifier] - rxdart 0.27.5 - shelf 1.3.2 [async collection http_parser path stack_trace stream_channel] - shelf_web_socket 1.0.2 [shelf stream_channel web_socket_channel] - sky_engine 0.0.99 - source_gen 1.2.2 [analyzer async build dart_style glob meta path source_span yaml] - source_helper 1.3.2 [analyzer collection source_gen] - source_span 1.8.2 [collection path term_glyph] - stack_trace 1.10.0 [path] - state_notifier 0.7.2+1 [meta] - stream_channel 2.1.0 [async] - stream_transform 2.0.0 - string_scanner 1.1.0 [charcode source_span] - term_glyph 1.2.0 - test_api 0.4.9 [async boolean_selector collection meta source_span stack_trace stream_channel string_scanner term_glyph matcher] - timing 1.0.0 [json_annotation] - typed_data 1.3.1 [collection] - url_launcher_android 6.0.17 [flutter url_launcher_platform_interface] - url_launcher_ios 6.0.17 [flutter url_launcher_platform_interface] - url_launcher_linux 3.0.1 [flutter url_launcher_platform_interface] - url_launcher_macos 3.0.1 [flutter url_launcher_platform_interface] - url_launcher_platform_interface 2.1.0 [flutter plugin_platform_interface] - url_launcher_web 2.0.12 [flutter flutter_web_plugins url_launcher_platform_interface] - url_launcher_windows 3.0.1 [flutter url_launcher_platform_interface] - vector_math 2.1.2 - watcher 1.0.1 [async path] - web_socket_channel 2.2.0 [async crypto stream_channel] - win32 2.7.0 [ffi] - xdg_directories 0.2.0+1 [meta path process] - xml 6.1.0 [collection meta petitparser] - yaml 3.1.1 [collection source_span string_scanner] ```