Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 [firebase_analytics] cannot set default parameter due to invalid type #9698

Closed
kkoken opened this issue Oct 10, 2022 · 18 comments
Closed
Assignees
Labels
platform: android Issues / PRs which are specifically for Android. plugin: analytics resolution: fixed A fix has been merged or is pending merge from a PR. type: bug Something isn't working

Comments

@kkoken
Copy link

kkoken commented Oct 10, 2022

Bug report

Describe the bug
Cannot set Default parameter to firebase analytics using firebaseAnalytics.setDefaultEventParameters.
It gives me an error of invalid default event parameter type and only happens in Android.

W/FA      (24001): Invalid default event parameter type. Name, value: isFree, true
W/FA      (24001): Invalid default event parameter type. Name, value: optIn, true
W/FA      (24001): Invalid default event parameter type. Name, value: isGranted, true

Steps to reproduce

Test device -> Xiaomi Mi 9T(or K20) (Android 11)

// Defined top of the main func
final FirebaseAnalytics firebaseAnalytics = FirebaseAnalytics.instance;
void main() {
// code
}
// Method runs after after splash
Future<void> initializeAnalytics() async {
 await firebaseAnalytics.setUserId(id: model.id);

 final Map<String, Object?> superProperties = <String, Object?>{};

 final isAllowed = await NotificationService.instance.notificationPermissionStatus;

 superProperties.putIfAbsent('isFree', () => model.free);
 superProperties.putIfAbsent('optIn', () => isAllowed);
 superProperties.putIfAbsent('isGranted', () => model.isGranted);

 await firebaseAnalytics.setDefaultEventParameters(superProperties);
}

Expected behavior

To be able to set the default parameters to all events.

Sample project

https://github.com/kaankoken/firebase-analytic-error-flutter-exp


Flutter doctor

Run flutter doctor and paste the output below:

Click To Expand
 flutter doctor -v
[✓] Flutter (Channel stable, 3.0.5, on macOS 12.6 21G115 darwin-x64, locale en-TR)
    • Flutter version 3.0.5 at /Users/kaantahakoken/fvm/versions/3.0.5
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision f1875d570e (3 months 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 32.1.0-rc1)
    • Android SDK at /Users/kaantahakoken/Library/Android/sdk
    • Platform android-33, build-tools 32.1.0-rc1
    • ANDROID_HOME = /Users/kaantahakoken/Library/Android/sdk
    • ANDROID_SDK_ROOT = /Users/kaantahakoken/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.0.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.11.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.2)
    • 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 11.0.12+0-b1504.28-7817840)

[✓] VS Code (version 1.72.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.50.0

[✓] Connected device (3 available)
    • Mi 9T (mobile)  • c22e6ace • android-arm64  • Android 11 (API 30)
    • macOS (desktop) • macos    • darwin-x64     • macOS 12.6 21G115 darwin-x64
    • Chrome (web)    • chrome   • web-javascript • Google Chrome 105.0.5195.125
    ! Error: Mithat iPhone’u is not connected. Xcode will continue when Mithat iPhone’u is connected and unlocked. (code -13)

[✓] 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
gain 4.0.0+206

dependencies:
- adjust_sdk 4.29.2 [flutter meta]
- audio_video_progress_bar 0.9.0 [flutter]
- auto_orientation 2.2.1 [flutter]
- auto_size_text 3.0.0 [flutter]
- better_player 0.0.83 [flutter cupertino_icons wakelock meta flutter_widget_from_html_core visibility_detector path_provider collection xml]
- cached_network_image 3.2.1 [flutter flutter_cache_manager octo_image cached_network_image_platform_interface cached_network_image_web]
- collection 1.16.0
- connectivity_plus 2.2.2 [flutter connectivity_plus_platform_interface connectivity_plus_linux connectivity_plus_macos connectivity_plus_web connectivity_plus_windows]
- cupertino_icons 1.0.5
- dart_code_metrics 4.17.0 [analyzer analyzer_plugin ansicolor args collection crypto file glob html meta path source_span xml yaml]
- device_info_plus 4.1.0 [flutter device_info_plus_platform_interface device_info_plus_macos device_info_plus_linux device_info_plus_web device_info_plus_windows]
- dio 4.0.6 [http_parser path]
- dio_cache_interceptor 3.3.0 [dio uuid string_scanner]
- firebase_analytics 9.3.3 [firebase_analytics_platform_interface firebase_analytics_web firebase_core firebase_core_platform_interface flutter]
- firebase_core 1.21.1 [firebase_core_platform_interface firebase_core_web flutter meta]
- firebase_crashlytics 2.8.9 [firebase_core firebase_core_platform_interface firebase_crashlytics_platform_interface flutter stack_trace]
- firebase_performance 0.8.2+4 [firebase_core firebase_core_platform_interface firebase_performance_platform_interface firebase_performance_web flutter]
- firebase_remote_config 2.0.16 [firebase_core firebase_core_platform_interface firebase_remote_config_platform_interface firebase_remote_config_web flutter]
- flutter 0.0.0 [characters collection material_color_utilities meta vector_math sky_engine]
- flutter_cache_manager 3.3.0 [clock collection file flutter http path path_provider pedantic rxdart sqflite uuid]
- flutter_dotenv 5.0.2 [flutter]
- flutter_downloader 1.8.3 [flutter]
- flutter_local_notifications 9.7.0 [clock flutter flutter_local_notifications_linux flutter_local_notifications_platform_interface timezone]
- flutter_localizations 0.0.0 [flutter intl characters clock collection material_color_utilities meta path vector_math]
- flutter_pip 0.0.1 [flutter flutter_web_plugins plugin_platform_interface]
- flutter_riverpod 2.0.0-dev.9 [collection flutter meta riverpod state_notifier]
- flutter_secure_storage 5.1.0 [flutter flutter_secure_storage_linux flutter_secure_storage_macos flutter_secure_storage_platform_interface flutter_secure_storage_web flutter_secure_storage_windows meta]
- flutter_svg 1.1.1+1 [flutter meta path_drawing vector_math xml]
- flutter_video_cast 1.0.3 [flutter stream_transform]
- freezed_annotation 2.1.0 [collection json_annotation meta]
- get_it 7.2.0 [async collection]
- google_fonts 3.0.1 [flutter http path_provider crypto]
- hive 2.2.3 [meta crypto]
- hive_flutter 1.1.0 [flutter hive path_provider path]
- image_picker 0.8.5+3 [flutter image_picker_android image_picker_for_web image_picker_ios image_picker_platform_interface]
- in_app_purchase 3.0.6 [flutter in_app_purchase_android in_app_purchase_platform_interface in_app_purchase_storekit]
- intl 0.17.0 [clock path]
- json_annotation 4.6.0 [meta]
- mask_text_input_formatter 2.3.0 [flutter]
- package_info_plus 1.4.3 [flutter package_info_plus_platform_interface package_info_plus_linux package_info_plus_macos package_info_plus_windows package_info_plus_web]
- path_provider 2.0.10 [flutter path_provider_android path_provider_ios path_provider_linux path_provider_macos path_provider_platform_interface path_provider_windows]
- permission_handler 10.0.0 [flutter meta permission_handler_android permission_handler_apple permission_handler_windows permission_handler_platform_interface]
- pretty_dio_logger 1.2.0-beta-1 [dio]
- provider 6.0.2 [collection flutter nested]
- retrofit 3.0.1+1 [dio meta]
- share_plus 4.0.4 [meta mime flutter share_plus_platform_interface share_plus_linux share_plus_macos share_plus_windows share_plus_web]
- shared_preferences 2.0.13 [flutter shared_preferences_android shared_preferences_ios shared_preferences_linux shared_preferences_macos shared_preferences_platform_interface shared_preferences_web shared_preferences_windows]
- shimmer 2.0.0 [flutter]
- smooth_page_indicator 1.0.0+2 [flutter]
- store_redirect 2.0.1 [flutter]
- subtitle_wrapper_package 2.1.0 [better_player bloc equatable flutter flutter_bloc http http_parser]
- uni_links 0.5.1 [flutter uni_links_platform_interface uni_links_web]
- url_launcher 6.0.20 [flutter url_launcher_android url_launcher_ios url_launcher_linux url_launcher_macos url_launcher_platform_interface url_launcher_web url_launcher_windows]
- version 3.0.2
- video_player 2.2.5 [flutter meta video_player_platform_interface video_player_web html]
- wakelock 0.6.1+2 [flutter meta wakelock_macos wakelock_platform_interface wakelock_web wakelock_windows]
- webview_cookie_manager 2.0.6 [flutter]
- webview_flutter 3.0.4 [flutter webview_flutter_android webview_flutter_platform_interface webview_flutter_wkwebview]

dev dependencies:
- analyzer 4.7.0 [_fe_analyzer_shared collection convert crypto glob meta package_config path pub_semver source_span watcher yaml]
- build_runner 2.2.0 [args async analyzer build build_config build_daemon build_resolvers build_runner_core code_builder collection crypto dart_style frontend_server_client glob graphs http_multi_server io js logging meta mime package_config path pool pub_semver pubspec_parse shelf shelf_web_socket stack_trace stream_transform timing watcher web_socket_channel 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 collection matcher material_color_utilities meta source_span stream_channel string_scanner term_glyph]
- freezed 2.1.0+1 [analyzer build build_config collection meta source_gen freezed_annotation json_annotation]
- hive_generator 1.1.3 [build source_gen hive analyzer source_helper]
- json_serializable 6.3.1 [analyzer async build build_config collection json_annotation meta path pub_semver pubspec_parse source_gen source_helper]
- retrofit_generator 4.0.3 [dio source_gen built_collection code_builder tuple retrofit analyzer dart_style build]

dependency overrides:
- analyzer 4.7.0 [_fe_analyzer_shared collection convert crypto glob meta package_config path pub_semver source_span watcher yaml]

transitive dependencies:
- _fe_analyzer_shared 47.0.0 [meta]
- _flutterfire_internals 1.0.2 [cloud_firestore_platform_interface cloud_firestore_web collection firebase_core firebase_core_platform_interface flutter meta]
- analyzer_plugin 0.10.0 [analyzer collection dart_style pub_semver yaml]
- ansicolor 2.0.1
- args 2.3.1
- async 2.8.2 [collection meta]
- bloc 8.1.0 [meta]
- boolean_selector 2.1.0 [source_span string_scanner]
- build 2.3.1 [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 web_socket_channel]
- build_resolvers 2.0.10 [analyzer async build crypto graphs logging path package_config pool pub_semver stream_transform yaml]
- build_runner_core 7.2.4 [async build build_config build_resolvers collection convert crypto glob graphs json_annotation logging meta path package_config pool timing watcher yaml]
- built_collection 5.1.1
- built_value 8.4.1 [built_collection collection fixnum meta]
- cached_network_image_platform_interface 1.0.0 [flutter flutter_cache_manager]
- cached_network_image_web 1.0.1 [flutter flutter_cache_manager cached_network_image_platform_interface]
- 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.7 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface]
- cloud_firestore_web 2.8.10 [_flutterfire_internals cloud_firestore_platform_interface collection firebase_core firebase_core_web flutter flutter_web_plugins js]
- code_builder 4.3.0 [built_collection built_value collection matcher meta]
- connectivity_plus_linux 1.3.1 [flutter connectivity_plus_platform_interface meta nm]
- connectivity_plus_macos 1.2.6 [connectivity_plus_platform_interface flutter]
- connectivity_plus_platform_interface 1.2.1 [flutter meta plugin_platform_interface]
- connectivity_plus_web 1.2.5 [connectivity_plus_platform_interface flutter_web_plugins flutter js]
- connectivity_plus_windows 1.2.2 [connectivity_plus_platform_interface flutter]
- convert 3.0.2 [typed_data]
- cross_file 0.3.3+2 [js meta]
- crypto 3.0.2 [typed_data]
- csslib 0.17.2 [source_span]
- dart_style 2.2.4 [analyzer args path pub_semver source_span]
- dbus 0.7.8 [args ffi meta xml]
- device_info_plus_linux 2.1.1 [device_info_plus_platform_interface file flutter meta]
- device_info_plus_macos 2.2.3 [device_info_plus_platform_interface flutter]
- device_info_plus_platform_interface 2.6.1 [flutter meta plugin_platform_interface]
- device_info_plus_web 2.1.0 [device_info_plus_platform_interface flutter_web_plugins flutter]
- device_info_plus_windows 3.0.3 [device_info_plus_platform_interface ffi flutter win32]
- equatable 2.0.5 [collection meta]
- fake_async 1.3.0 [clock collection]
- ffi 2.0.1
- file 6.1.4 [meta path]
- firebase 9.0.3 [http http_parser js]
- firebase_analytics_platform_interface 3.3.7 [_flutterfire_internals firebase_core flutter meta plugin_platform_interface]
- firebase_analytics_web 0.4.2+7 [_flutterfire_internals firebase_analytics_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins js]
- firebase_core_platform_interface 4.5.1 [collection flutter flutter_test meta plugin_platform_interface]
- firebase_core_web 1.7.3 [firebase_core_platform_interface flutter flutter_web_plugins js meta]
- firebase_crashlytics_platform_interface 3.2.19 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface]
- firebase_performance_platform_interface 0.1.1+19 [_flutterfire_internals firebase_core flutter plugin_platform_interface]
- firebase_performance_web 0.1.1+8 [_flutterfire_internals firebase firebase_core firebase_core_web firebase_performance_platform_interface flutter flutter_web_plugins js]
- firebase_remote_config_platform_interface 1.1.19 [_flutterfire_internals firebase_core flutter meta plugin_platform_interface]
- firebase_remote_config_web 1.1.8 [firebase_core firebase_core_web firebase_remote_config_platform_interface flutter flutter_web_plugins js]
- fixnum 1.0.1
- flutter_bloc 8.1.1 [flutter bloc provider]
- flutter_blurhash 0.7.0 [flutter]
- flutter_local_notifications_linux 0.5.1 [flutter flutter_local_notifications_platform_interface dbus path xdg_directories]
- flutter_local_notifications_platform_interface 5.0.0 [flutter plugin_platform_interface]
- flutter_plugin_android_lifecycle 2.0.7 [flutter]
- flutter_secure_storage_linux 1.1.1 [flutter flutter_secure_storage_platform_interface]
- flutter_secure_storage_macos 1.1.1 [flutter flutter_secure_storage_platform_interface]
- flutter_secure_storage_platform_interface 1.0.0 [flutter plugin_platform_interface]
- flutter_secure_storage_web 1.0.2 [flutter flutter_web_plugins flutter_secure_storage_platform_interface js]
- flutter_secure_storage_windows 1.1.2 [flutter flutter_secure_storage_platform_interface]
- flutter_web_plugins 0.0.0 [flutter js characters collection material_color_utilities meta vector_math]
- flutter_widget_from_html_core 0.8.5+3 [csslib flutter fwfh_text_style html]
- frontend_server_client 2.1.3 [async path]
- fwfh_text_style 2.22.08 [flutter]
- glob 2.1.0 [async collection file path string_scanner]
- graphs 2.1.0 [collection]
- html 0.15.0 [csslib source_span]
- http 0.13.5 [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_picker_android 0.8.5+3 [flutter flutter_plugin_android_lifecycle image_picker_platform_interface]
- image_picker_for_web 2.1.10 [flutter flutter_web_plugins image_picker_platform_interface]
- image_picker_ios 0.8.6+1 [flutter image_picker_platform_interface]
- image_picker_platform_interface 2.6.2 [cross_file flutter http plugin_platform_interface]
- in_app_purchase_android 0.2.3+5 [collection flutter in_app_purchase_platform_interface json_annotation]
- in_app_purchase_platform_interface 1.3.2 [flutter plugin_platform_interface]
- in_app_purchase_storekit 0.3.2+2 [collection flutter in_app_purchase_platform_interface json_annotation]
- io 1.0.3 [meta path string_scanner]
- js 0.6.4
- lints 2.0.0
- logging 1.1.0
- matcher 0.12.11 [stack_trace]
- material_color_utilities 0.1.4
- meta 1.7.0
- mime 1.0.2
- nested 1.0.0 [flutter]
- nm 0.5.0 [dbus]
- octo_image 1.0.2 [flutter flutter_blurhash]
- package_config 2.1.0 [path]
- package_info_plus_linux 1.0.5 [package_info_plus_platform_interface flutter path]
- package_info_plus_macos 1.3.0 [flutter]
- package_info_plus_platform_interface 1.0.2 [flutter meta plugin_platform_interface]
- package_info_plus_web 1.0.6 [flutter flutter_web_plugins http meta package_info_plus_platform_interface]
- package_info_plus_windows 2.1.0 [package_info_plus_platform_interface ffi flutter win32]
- path 1.8.1
- path_drawing 1.0.1 [vector_math meta path_parsing flutter]
- path_parsing 1.0.1 [vector_math meta]
- path_provider_android 2.0.20 [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.5 [flutter platform plugin_platform_interface]
- path_provider_windows 2.1.3 [ffi flutter path path_provider_platform_interface win32]
- pedantic 1.11.1
- permission_handler_android 10.1.0 [flutter permission_handler_platform_interface]
- permission_handler_apple 9.0.6 [flutter permission_handler_platform_interface]
- permission_handler_platform_interface 3.9.0 [flutter meta plugin_platform_interface]
- permission_handler_windows 0.1.1 [flutter permission_handler_platform_interface]
- petitparser 5.0.0 [meta]
- platform 3.1.0
- plugin_platform_interface 2.1.3 [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.1 [checked_yaml collection json_annotation pub_semver yaml]
- riverpod 2.0.0-dev.9 [collection meta stack_trace state_notifier]
- rxdart 0.27.5
- share_plus_linux 3.0.0 [share_plus_platform_interface file flutter meta url_launcher]
- share_plus_macos 3.0.1 [share_plus_platform_interface flutter]
- share_plus_platform_interface 3.1.1 [cross_file flutter meta mime plugin_platform_interface]
- share_plus_web 3.0.0 [share_plus_platform_interface url_launcher flutter flutter_web_plugins meta]
- share_plus_windows 3.0.0 [share_plus_platform_interface flutter meta url_launcher]
- shared_preferences_android 2.0.13 [flutter shared_preferences_platform_interface]
- shared_preferences_ios 2.1.1 [flutter shared_preferences_platform_interface]
- shared_preferences_linux 2.1.1 [file flutter path path_provider_linux path_provider_platform_interface shared_preferences_platform_interface]
- shared_preferences_macos 2.0.4 [flutter shared_preferences_platform_interface]
- shared_preferences_platform_interface 2.1.0 [flutter plugin_platform_interface]
- shared_preferences_web 2.0.4 [flutter flutter_web_plugins shared_preferences_platform_interface]
- shared_preferences_windows 2.1.1 [file flutter path path_provider_platform_interface path_provider_windows shared_preferences_platform_interface]
- shelf 1.4.0 [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.5 [analyzer async build dart_style glob meta path source_span yaml]
- source_helper 1.3.3 [analyzer collection source_gen]
- source_span 1.8.2 [collection path term_glyph]
- sqflite 2.0.3+1 [flutter sqflite_common path]
- sqflite_common 2.3.0 [synchronized path meta]
- stack_trace 1.10.0 [path]
- state_notifier 0.7.2+1 [meta]
- stream_channel 2.1.0 [async]
- stream_transform 2.0.1
- string_scanner 1.1.0 [charcode source_span]
- synchronized 3.0.0+3
- 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]
- timezone 0.8.0 [path]
- timing 1.0.0 [json_annotation]
- tuple 2.0.1
- typed_data 1.3.1 [collection]
- uni_links_platform_interface 1.0.0 [flutter plugin_platform_interface]
- uni_links_web 0.1.0 [flutter flutter_web_plugins uni_links_platform_interface]
- url_launcher_android 6.0.19 [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.1 [flutter plugin_platform_interface]
- url_launcher_web 2.0.13 [flutter flutter_web_plugins url_launcher_platform_interface]
- url_launcher_windows 3.0.1 [flutter url_launcher_platform_interface]
- uuid 3.0.6 [crypto]
- vector_math 2.1.2
- video_player_platform_interface 4.2.0 [flutter flutter_test meta]
- video_player_web 2.0.12 [flutter flutter_web_plugins video_player_platform_interface]
- visibility_detector 0.3.3 [flutter]
- wakelock_macos 0.4.0 [flutter flutter_web_plugins wakelock_platform_interface]
- wakelock_platform_interface 0.3.0 [flutter meta]
- wakelock_web 0.4.0 [flutter flutter_web_plugins js wakelock_platform_interface]
- wakelock_windows 0.2.0 [flutter wakelock_platform_interface win32]
- watcher 1.0.1 [async path]
- web_socket_channel 2.2.0 [async crypto stream_channel]
- webview_flutter_android 2.10.4 [flutter webview_flutter_platform_interface]
- webview_flutter_platform_interface 1.9.5 [flutter meta plugin_platform_interface]
- webview_flutter_wkwebview 2.9.5 [flutter path webview_flutter_platform_interface]
- win32 2.7.0 [ffi]
- xdg_directories 0.2.0+2 [meta path process]
- xml 6.1.0 [collection meta petitparser]
- yaml 3.1.1 [collection source_span string_scanner]

@kkoken kkoken added Needs Attention This issue needs maintainer attention. type: bug Something isn't working labels Oct 10, 2022
@darshankawar darshankawar added the triage Issue is currently being triaged. label Oct 10, 2022
@darshankawar
Copy link

Thanks for the report @kkoken
Can you provide a complete minimal reproducible code sample that shows the current behavior ?

@darshankawar darshankawar added blocked: customer-response Waiting for customer response, e.g. more information was requested. and removed Needs Attention This issue needs maintainer attention. labels Oct 10, 2022
@kkoken
Copy link
Author

kkoken commented Oct 11, 2022

@darshankawar Should I include google-services.json under android/app/src or will you guys add to project?

@google-oss-bot google-oss-bot added Needs Attention This issue needs maintainer attention. and removed blocked: customer-response Waiting for customer response, e.g. more information was requested. labels Oct 11, 2022
@kkoken
Copy link
Author

kkoken commented Oct 11, 2022

@darshankawar without google-services.json example

@darshankawar
Copy link

Thanks for the details. Using it, I am getting same behavior on Android as reported.

/cc @russellwheatley

@darshankawar darshankawar added plugin: analytics platform: android Issues / PRs which are specifically for Android. and removed Needs Attention This issue needs maintainer attention. triage Issue is currently being triaged. labels Oct 11, 2022
@kkoken
Copy link
Author

kkoken commented Oct 11, 2022

@darshankawar @russellwheatley It appears to be analytics.setDefaultEventParameters (line 309) on FlutterFirebaseAnalyticsPlugin.java file does not accept boolean values.


Method Explanation:

public void setDefaultEventParameters (Bundle parameters)

Adds parameters that will be set on every event logged from the SDK, including automatic ones. The values passed in the parameters bundle will be added to the map of default event parameters. These parameters persist across app runs. They are of lower precedence than event parameters, so if an event parameter and a parameter set using this API have the same name, the value of the event parameter will be used. The same limitations on event parameters apply to default event parameters.

Parameters

parameters
Parameters to be added to the map of parameters added to every event. They will be added to the map of default event parameters, replacing any existing parameter with the same name. **Valid parameter values are String, long, and double.** Setting a key's value to null will clear that parameter. Passing in a null bundle will clear all parameters.

Valid parameter values are String, long, and double.

@darshankawar
Copy link

darshankawar commented Oct 12, 2022

Valid parameter values are String, long, and double.

That is correct. The plugin is wrapper around native Firebase SDK and leverages what is provided by Android Firebase SDK, so this may not be an actual issue as bool is not a valid type to use and plugin throws correct error as reported originally.

@kkoken
Copy link
Author

kkoken commented Oct 13, 2022

@darshankawar

Valid parameter values are String, long, and double.

That is correct. The plugin is wrapper around native Firebase SDK and leverages what is provided by Android Firebase SDK, so this may not be an actual issue as bool is not a valid type to use and plugin throws correct error as reported originally.

Since the flutter side accepts any object(primitive types), should not the flutter side warn us? or should not the types be limited to those three? If I have not to look the detail of the actual method, I would not have figured that out.

Then, I need to ask another question about that. Why the iOS accept the bool type? One platform accepts and the other does not. It looks weird when we think of Flutter's perspective

@russellwheatley
Copy link
Member

russellwheatley commented Oct 20, 2022

@kkoken We have a PR for this reason which will enforce stricter types (i.e. strings & numbers) to avoid this confusion: #9520. Although setDefaultEventParameters() hasn't been included in the PR, I will update the description to mark this as a TODO. Thanks.

@russellwheatley
Copy link
Member

In relation to iOS accepting booleans. are you sure that is true? See docs: https://firebase.google.com/docs/reference/ios/firebaseanalytics/api/reference/Classes/FIRAnalytics#+setdefaulteventparameters:

Quote:

The same limitations on event parameters apply to default event parameters.

Then read the event parameters documentation: https://firebase.google.com/docs/reference/ios/firebaseanalytics/api/reference/Classes/FIRAnalytics#+logeventwithname:parameters:

Quote:

Only String, Int, and Double parameter types are supported

@kkoken
Copy link
Author

kkoken commented Oct 20, 2022

In relation to iOS accepting booleans. are you sure that is true? See docs: https://firebase.google.com/docs/reference/ios/firebaseanalytics/api/reference/Classes/FIRAnalytics#+setdefaulteventparameters:

Quote:

The same limitations on event parameters apply to default event parameters.

Then read the event parameters documentation: https://firebase.google.com/docs/reference/ios/firebaseanalytics/api/reference/Classes/FIRAnalytics#+logeventwithname:parameters:

Quote:

Only String, Int, and Double parameter types are supported

We checked the firebase events on BigQuery, and we were seeing the bool parameters.

Could swift/objc parse bool as int?

@russellwheatley
Copy link
Member

@kkoken What type is it appearing as on BigQuery? We actually pass the values straight to logEvent with next to no type checking on values here.

If you check Flutter docs, a boolean passed over the method channel to obj-c implementation is parsed as NSNumber numberWithBool:. See docs. So maybe it is sent as a number?

@kkoken
Copy link
Author

kkoken commented Oct 20, 2022

@kkoken What type is it appearing as on BigQuery? We actually pass the values straight to logEvent with next to no type checking on values here.

If you check Flutter docs, a boolean passed over the method channel to obj-c implementation is parsed as NSNumber numberWithBool:. See docs. So maybe it is sent as a number?

We were sending as bool for both clients. Ios was appearing on BigQuery and android was not. Thats why I only reported android.

I will talk again with the analytic team to send the previous output and get back to you with outputs.

@russellwheatley
Copy link
Member

russellwheatley commented Oct 20, 2022

@kkoken sorry, my question wasn't worded correctly. I know you're sending the value as a boolean. I want to know if it appears as a boolean on BigQuery?

I'm wondering if the Firebase iOS SDK is reading the value as a number and sending it along as a number to Analytic's server. Or, maybe it doesn't type check for boolean as might be the case for android, and that is why you're able to get a boolean in BgQuery 🤔

@kkoken
Copy link
Author

kkoken commented Oct 21, 2022

@russellwheatley I am very sorry for the late response. I talked with the analytic team, and they said they saw the data as bool on BigQuery. Also, I checked our app's FirebaseCrashlytics iOS logs.

the parameters' values are shown as int. I am adding the screenshots to look more in detail.
(PS: parameter names can differ, but they are identical.)

(isFree = isPremium, pushOptIn = optIn, isGranted = iysPermitted)
image

@kkoken
Copy link
Author

kkoken commented Nov 4, 2022

@russellwheatley any news? I can offer my help on this matter.

@russellwheatley
Copy link
Member

Hey @kkoken, we're waiting for confirmation from the Analytic's team. However, all signs indicate that the values accepted are string, int, and double parameter types. Once we have the green light, we will be strongly typing the inputs accepted for default event parameters and custom events which will be updated in this PR. I'd recommend following the documentation if you don't want unexpected results.

@kkoken
Copy link
Author

kkoken commented Dec 2, 2022

Hey @kkoken, we're waiting for confirmation from the Analytic's team. However, all signs indicate that the values accepted are string, int, and double parameter types. Once we have the green light, we will be strongly typing the inputs accepted for default event parameters and custom events which will be updated in this PR. I'd recommend following the documentation if you don't want unexpected results.

Thank you very much for your answer. I am looking forward to checking the changes in the documentation.

@russellwheatley
Copy link
Member

We have updated the setDefaultEventParameters() implementation to assert() on the values accepted. See here: #9520

In a nutshell; default parameters can only have the value num, String or null.

@darshankawar darshankawar added the resolution: fixed A fix has been merged or is pending merge from a PR. label Dec 29, 2022
@firebase firebase locked and limited conversation to collaborators Jan 29, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
platform: android Issues / PRs which are specifically for Android. plugin: analytics resolution: fixed A fix has been merged or is pending merge from a PR. type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants