flutterfire icon indicating copy to clipboard operation
flutterfire copied to clipboard

🐛 [firebase_dynamic_links: 4.1.0] No link is retrived both on initial & listen methods

Open irajeshh opened this issue 4 years ago • 8 comments

Bug report

Describe the bug firebase_dynamic_links version 4.0.7 was working properly, but it was updated to 4.1.0. So the firebase_dynamic_links_platform_interface also updated from 0.2.1 to '0.2.2'.

Whenever a dynamic link is retrived, Unhandled Exception: type '_InternalLinkedHashMap<Object?, Object?>' is not a subtype of type 'Map<String, String>' exception was thrown in debug mode.

I came to find it was caused by the new object utmParameters in PendingDynamicLinkData.dart file.

Steps to reproduce

Steps to reproduce the behavior:

  1. firebase_dynamic_links: 4.1.0
  2. create a short dynamic link only with the following
DynamicLinkParameters parameters = DynamicLinkParameters(
      uriPrefix: uriPrefix,
      link: link,
      androidParameters: _androidParameters(),
      socialMetaTagParameters: socialMetaTagParameters,
    );
  1. retrive the created url witht the following code
  final PendingDynamicLinkData? data = await dynamicLinks.getDynamicLink(Uri.parse(Link));
  final Uri? deepLink = data?.link;
  print(deepLink);

Expected behavior

Sample project

ElevatedButton(
            child: const Text('getDynamicLink'),
            onPressed: () async {
              FirebaseDynamicLinks dynamicLinks = FirebaseDynamicLinks.instance;
              
              String firstlink = "https://created.dynamic.link/abc";
              print("firstlink:$firstlink");
              Uri uri = Uri.parse(firstlink);
              final PendingDynamicLinkData? data =  await dynamicLinks.getDynamicLink(uri);
              final Uri? deepLink = data?.link;
              print(deepLink);
            },
          ),

Example project


Flutter doctor

Run flutter doctor and paste the output below:

Click To Expand
[✓] Flutter (Channel stable, 2.10.1, on Zorin OS 16.1 5.13.0-35-generic, locale en_GB.UTF-8)
[!] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
    ✗ cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/linux#android-setup for more details.
[✓] Chrome - develop for the web
[✓] Linux toolchain - develop for Linux desktop
[✓] Android Studio (version 2021.1)
[✓] VS Code (version 1.65.1)
[✓] Connected device (3 available)
[✓] HTTP Host Availability

! Doctor found issues in 1 category.

Flutter dependencies

Run flutter pub deps -- --style=compact and paste the output below:

Click To Expand
Dart SDK 2.16.1
Flutter SDK 2.10.1
projectname 2.1.2

dependencies:
- bloc_concurrency 0.2.0 [bloc stream_transform]
- cached_network_image 3.2.0 [flutter flutter_cache_manager octo_image cached_network_image_platform_interface cached_network_image_web]
- cloud_firestore 3.1.5 [cloud_firestore_platform_interface cloud_firestore_web collection firebase_core firebase_core_platform_interface flutter meta]
- equatable 2.0.3 [collection meta]
- fast_contacts 1.1.0 [flutter]
- firebase_auth 3.3.4 [firebase_auth_platform_interface firebase_auth_web firebase_core firebase_core_platform_interface flutter meta]
- firebase_dynamic_links 4.0.7 [firebase_core firebase_core_platform_interface firebase_dynamic_links_platform_interface flutter meta plugin_platform_interface]
- firebase_messaging 11.2.4 [firebase_core firebase_core_platform_interface firebase_messaging_platform_interface firebase_messaging_web flutter meta]
- firebase_storage 10.2.4 [firebase_core firebase_core_platform_interface firebase_storage_platform_interface firebase_storage_web flutter]
- flutter 0.0.0 [characters collection material_color_utilities meta typed_data vector_math sky_engine]
- flutter_bloc 8.0.1 [flutter bloc provider]
- flutter_local_notifications 9.1.5 [clock flutter flutter_local_notifications_linux flutter_local_notifications_platform_interface timezone]
- flutter_phone_direct_caller 2.1.0 [flutter]
- flutter_svg 1.0.3 [flutter meta path_drawing vector_math xml]
- fluttertoast 8.0.8 [flutter flutter_web_plugins]
- image_cropper 1.4.1 [flutter]
- image_picker 0.8.4+4 [flutter flutter_plugin_android_lifecycle image_picker_for_web image_picker_platform_interface]
- permission_handler 8.3.0 [flutter meta permission_handler_platform_interface]
- phone_number 0.12.0+1 [flutter meta]
- razorpay_flutter 1.2.7 [flutter eventify]
- restart_app 1.1.0 [flutter flutter_web_plugins]
- rive 0.8.1 [collection flutter graphs http meta]
- share 2.0.4 [meta mime flutter]
- share_files_and_screenshot_widgets 1.0.6 [path_provider flutter]
- url_launcher 6.0.17 [flutter meta url_launcher_android url_launcher_ios url_launcher_linux url_launcher_macos url_launcher_platform_interface url_launcher_web url_launcher_windows]

dev dependencies:
- 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 typed_data]

transitive dependencies:
- args 2.3.0
- async 2.8.2 [collection meta]
- bloc 8.0.3 [meta]
- boolean_selector 2.1.0 [source_span string_scanner]
- 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
- clock 1.1.0
- cloud_firestore_platform_interface 5.5.1 [collection firebase_core flutter meta plugin_platform_interface]
- cloud_firestore_web 2.6.10 [cloud_firestore_platform_interface collection firebase_core firebase_core_web flutter flutter_web_plugins js]
- collection 1.15.0
- cross_file 0.3.2 [flutter js meta]
- crypto 3.0.1 [collection typed_data]
- dbus 0.7.1 [args ffi meta xml]
- eventify 1.0.0
- fake_async 1.2.0 [clock collection]
- ffi 1.1.2
- file 6.1.2 [meta path]
- firebase_auth_platform_interface 6.2.1 [firebase_core flutter meta plugin_platform_interface]
- firebase_auth_web 3.3.9 [firebase_auth_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins http_parser intl js meta]
- firebase_core 1.13.1 [firebase_core_platform_interface firebase_core_web flutter meta]
- firebase_core_platform_interface 4.2.5 [collection flutter meta plugin_platform_interface]
- firebase_core_web 1.6.1 [firebase_core_platform_interface flutter flutter_web_plugins js meta]
- firebase_dynamic_links_platform_interface 0.2.1 [firebase_core flutter meta plugin_platform_interface]
- firebase_messaging_platform_interface 3.2.1 [firebase_core flutter meta plugin_platform_interface]
- firebase_messaging_web 2.2.9 [firebase_core firebase_core_web firebase_messaging_platform_interface flutter flutter_web_plugins js meta]
- firebase_storage_platform_interface 4.1.1 [collection firebase_core flutter meta plugin_platform_interface]
- firebase_storage_web 3.2.10 [async firebase_core firebase_core_web firebase_storage_platform_interface flutter flutter_web_plugins http js meta]
- flutter_blurhash 0.6.4 [flutter]
- flutter_cache_manager 3.3.0 [clock collection file flutter http path path_provider pedantic rxdart sqflite uuid]
- flutter_local_notifications_linux 0.4.2 [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.5 [flutter]
- flutter_web_plugins 0.0.0 [flutter js characters collection material_color_utilities meta typed_data vector_math]
- graphs 2.1.0 [collection]
- http 0.13.4 [async http_parser meta path]
- http_parser 4.0.0 [charcode collection source_span string_scanner typed_data]
- image_picker_for_web 2.1.6 [flutter flutter_web_plugins image_picker_platform_interface]
- image_picker_platform_interface 2.4.4 [cross_file flutter http plugin_platform_interface]
- intl 0.17.0 [clock path]
- js 0.6.3
- matcher 0.12.11 [stack_trace]
- material_color_utilities 0.1.3
- meta 1.7.0
- mime 1.0.1
- nested 1.0.0 [flutter]
- octo_image 1.0.1 [flutter flutter_blurhash]
- path 1.8.0
- path_drawing 1.0.0 [vector_math meta path_parsing flutter]
- path_parsing 1.0.0 [vector_math meta]
- path_provider 2.0.9 [flutter path_provider_android path_provider_ios path_provider_linux path_provider_macos path_provider_platform_interface path_provider_windows]
- path_provider_android 2.0.12 [flutter path_provider_platform_interface]
- path_provider_ios 2.0.8 [flutter path_provider_platform_interface]
- path_provider_linux 2.1.5 [ffi flutter path path_provider_platform_interface xdg_directories]
- path_provider_macos 2.0.5 [flutter path_provider_platform_interface]
- path_provider_platform_interface 2.0.3 [flutter platform plugin_platform_interface]
- path_provider_windows 2.0.5 [ffi flutter path path_provider_platform_interface win32]
- pedantic 1.11.1
- permission_handler_platform_interface 3.7.0 [flutter meta plugin_platform_interface]
- petitparser 4.4.0 [meta]
- platform 3.1.0
- plugin_platform_interface 2.1.2 [meta]
- process 4.2.4 [file path platform]
- provider 6.0.2 [collection flutter nested]
- rxdart 0.27.3
- sky_engine 0.0.99
- source_span 1.8.1 [collection path term_glyph]
- sqflite 2.0.2 [flutter sqflite_common path]
- sqflite_common 2.2.0 [synchronized path meta]
- stack_trace 1.10.0 [path]
- stream_channel 2.1.0 [async]
- stream_transform 2.0.0
- string_scanner 1.1.0 [charcode source_span]
- synchronized 3.0.0
- term_glyph 1.2.0
- test_api 0.4.8 [async boolean_selector collection meta source_span stack_trace stream_channel string_scanner term_glyph matcher]
- timezone 0.8.0 [path]
- typed_data 1.3.0 [collection]
- url_launcher_android 6.0.15 [flutter url_launcher_platform_interface]
- url_launcher_ios 6.0.15 [flutter url_launcher_platform_interface]
- url_launcher_linux 2.0.3 [flutter]
- url_launcher_macos 2.0.3 [flutter]
- url_launcher_platform_interface 2.0.5 [flutter plugin_platform_interface]
- url_launcher_web 2.0.9 [flutter flutter_web_plugins url_launcher_platform_interface]
- url_launcher_windows 2.0.2 [flutter]
- uuid 3.0.6 [crypto]
- vector_math 2.1.1
- win32 2.4.1 [ffi]
- xdg_directories 0.2.0+1 [meta path process]
- xml 5.3.1 [collection meta petitparser]

irajeshh avatar Mar 14 '22 07:03 irajeshh

After clean build, Forcefully using the below versions solved the issue. firebase_dynamic_links: 4.0.7 [in your pubsec.yaml[ firebase_dynamic_links_platform_interface: 0.2.1 [in the firebase_dynamic_links: 4.0.7 folder's pubspec.yaml file]

irajeshh avatar Mar 14 '22 07:03 irajeshh

Facing a similar issue the app gets opened but every time the data is null by both methods getInitailLink and onLInk stream

Peeyush14198 avatar Mar 14 '22 10:03 Peeyush14198

Can confirm.. link data is NULL.. it would be great help to write test around main functionality

alarmatwork avatar Mar 14 '22 11:03 alarmatwork

I did this but not working for me 😢 i'm continuing receiving the error when any dynamic link is triggered:

version 4.0.7

Captura de Tela 2022-03-14 às 09 14 43

pedrohsampaioo avatar Mar 14 '22 12:03 pedrohsampaioo

You have to l

I did this but not working for me 😢 i'm continuing receiving the error when any dynamic link is triggered:

version 4.0.7

You have to lock also version: firebase_dynamic_links_platform_interface: 0.2.1

alarmatwork avatar Mar 14 '22 12:03 alarmatwork

got it! it's working now!!! Thanks @alarmatwork @irajeshh

pedrohsampaioo avatar Mar 14 '22 12:03 pedrohsampaioo

I believe the said error:

Unhandled Exception: type '_InternalLinkedHashMap<Object?, Object?>' is not a subtype of type 'Map<String, String>' is causing due to the fix made to the latest plugin version : https://github.com/FirebaseExtended/flutterfire/commit/32d06e793b4fc1bc1dad9b9071f94b28c5d477ca

And this issue comment mentions same error: https://github.com/FirebaseExtended/flutterfire/commit/32d06e793b4fc1bc1dad9b9071f94b28c5d477ca#commitcomment-68482461

This PR fixes the type cast issue: https://github.com/FirebaseExtended/flutterfire/pull/8263 that you can subscribe to.

Also, there's a similar open issue describing the same case in which you can follow-up for further updates: https://github.com/FirebaseExtended/flutterfire/issues/8261 Closing this as a duplicate.

darshankawar avatar Mar 14 '22 12:03 darshankawar

You have to l

I did this but not working for me 😢 i'm continuing receiving the error when any dynamic link is triggered: version 4.0.7

You have to lock also version: firebase_dynamic_links_platform_interface: 0.2.1

Thanks

wepashka avatar Apr 01 '22 04:04 wepashka