firebase / flutterfire

πŸ”₯ A collection of Firebase plugins for Flutter apps.
https://firebase.google.com/docs/flutter/setup
BSD 3-Clause "New" or "Revised" License
8.68k stars 3.97k forks source link

πŸ› [firebase_messaging] Build failed with exception for Flutter versions which don't have macOS in TargetPlatform #4094

Closed kushksolves closed 3 years ago

kushksolves commented 3 years ago

Bug report

Describe the bug I am using Flutter 1.12.13+hotfix.9 and while trying to build the app after integrating firebase_messaging: 8.0.0-dev.8, it fails with an exception which is due to a check for macOS because my version of flutter doesn't have macOS defined in TargetPlatform enum. This must be working fine with the later versions of Flutter because macOS was introduced later.

Steps to reproduce

Steps to reproduce the behavior:

  1. Add these libraries in pubspec :- firebase_core: ^0.5.2 firebase_messaging: ^8.0.0-dev.8
  2. Try to install/build apk
  3. See exception - ../../flutter/.pub-cache/hosted/pub.dartlang.org/firebase_messaging_platform_interface-1.0.0-dev.5/lib/src/method_channel/method_channel_messaging.dart:311:49: Error: Getter not found: 'macOS'.

Expected behavior

Please add a check that if TargetPlatform enum contains macOS or not before doing the required operation.


Additional context

I want this library to work with previous versions of Flutter, because upgrading to latest version for using this library will put a lot of load on our development.


Flutter doctor

Run flutter doctor and paste the output below:

Click To Expand ``` [βœ“] Flutter (Channel unknown, v1.12.13+hotfix.9, on Linux, locale en_IN) [βœ“] Android toolchain - develop for Android devices (Android SDK version 30.0.1) [βœ“] Android Studio (version 3.6) [βœ“] Android Studio (version 4.0) [βœ“] VS Code (version 1.48.0) [βœ“] Connected device (1 available) β€’ No issues found! ```

Flutter dependencies

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

Click To Expand ``` Dart SDK 2.7.2 Flutter SDK 1.12.13+hotfix.9 nimble_pnm 6.0.0+12 dependencies: - barcode_scan 2.0.1 [flutter] - charts_flutter 0.9.0 [charts_common collection flutter intl logging meta] - chips_choice 1.2.0 [flutter] - circular_bottom_navigation 1.0.1 [flutter] - confetti 0.5.4+1 [flutter random_color vector_math] - cupertino_icons 0.1.3 - equatable 1.1.0 [collection meta] - expandable 4.1.3 [flutter] - firebase_core 0.5.2 [firebase_core_platform_interface flutter quiver meta firebase_core_web] - firebase_messaging 8.0.0-dev.8 [meta flutter firebase_core firebase_core_platform_interface firebase_messaging_platform_interface] - fluro 1.5.2 [flutter] - flutter 0.0.0 [collection meta typed_data vector_math sky_engine] - flutter_bloc 3.2.0 [flutter bloc provider] - flutter_bloc_list_manager 0.1.1 [flutter bloc equatable flutter_bloc meta] - flutter_html 0.11.1 [html flutter] - flutter_local_notifications 3.0.1 [flutter platform flutter_local_notifications_platform_interface timezone] - flutter_localizations 0.0.0 [flutter intl collection meta path typed_data vector_math] - flutter_secure_storage 3.3.1+1 [meta flutter] - flutter_swiper 1.1.6 [flutter transformer_page_view flutter_page_indicator] - flutter_typeahead 1.8.6 [flutter flutter_keyboard_visibility] - geocoding 1.0.4+1 [flutter geocoding_platform_interface url_launcher] - geolocator 6.0.0+4 [flutter geolocator_platform_interface] - http 0.12.0+4 [async http_parser path pedantic] - image_cropper 1.2.1 [flutter] - image_picker 0.6.5+2 [flutter flutter_plugin_android_lifecycle] - local_auth 0.4.0+1 [flutter meta intl] - location 3.0.2 [flutter meta location_platform_interface location_web] - maps_launcher 1.2.1 [flutter url_launcher] - mime 0.9.6+3 - package_info 0.4.0+16 [flutter] - permission_handler 5.0.1 [flutter meta permission_handler_platform_interface] - photo_view 0.10.1 [flutter] - shared_preferences 0.5.6+2 [meta flutter shared_preferences_platform_interface shared_preferences_macos shared_preferences_web] - sliding_up_panel 1.0.2 [flutter] - timezone 0.5.7 [path] - webview_flutter 0.3.22+1 [flutter] dev dependencies: - flutter_test 0.0.0 [flutter test_api path image quiver stack_trace vector_math archive args async boolean_selector charcode collection convert crypto matcher meta pedantic petitparser source_span stream_channel string_scanner term_glyph typed_data xml] dependency overrides: - intl 0.15.8 [path] transitive dependencies: - archive 2.0.11 [crypto args path] - args 1.5.2 - async 2.4.0 [collection] - bloc 3.0.0 [meta rxdart] - boolean_selector 1.0.5 [source_span string_scanner] - charcode 1.1.2 - charts_common 0.9.0 [collection intl logging meta vector_math] - collection 1.14.11 - convert 2.1.1 [charcode typed_data] - crypto 2.1.3 [collection convert typed_data] - csslib 0.16.1 [source_span] - 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] - firebase_messaging_platform_interface 1.0.0-dev.5 [flutter meta firebase_core plugin_platform_interface] - flutter_keyboard_visibility 3.2.1 [flutter] - flutter_local_notifications_platform_interface 2.0.0 [flutter plugin_platform_interface] - flutter_page_indicator 0.0.3 [flutter] - flutter_plugin_android_lifecycle 1.0.7 [flutter] - flutter_web_plugins 0.0.0 [flutter collection meta typed_data vector_math] - geocoding_platform_interface 1.0.1+1 [flutter meta plugin_platform_interface] - geolocator_platform_interface 1.0.4 [flutter meta plugin_platform_interface vector_math] - html 0.14.0+3 [csslib source_span] - http_parser 3.1.3 [charcode collection source_span string_scanner typed_data] - image 2.1.4 [archive xml] - js 0.6.2 - location_platform_interface 1.0.0 [flutter meta plugin_platform_interface] - location_web 1.0.0 [flutter flutter_web_plugins location_platform_interface http_parser meta js] - logging 0.11.4 - matcher 0.12.6 [stack_trace] - meta 1.1.8 - nested 0.0.4 [flutter] - path 1.6.4 - pedantic 1.8.0+1 - permission_handler_platform_interface 2.0.1 [flutter meta plugin_platform_interface] - petitparser 2.4.0 [meta] - platform 2.2.1 - plugin_platform_interface 1.0.2 [meta] - provider 4.0.1 [flutter nested] - quiver 2.0.5 [matcher meta] - random_color 1.0.5 [flutter] - rxdart 0.23.1 - shared_preferences_macos 0.0.1+6 [shared_preferences_platform_interface flutter] - shared_preferences_platform_interface 1.0.3 [meta flutter] - shared_preferences_web 0.1.2+4 [shared_preferences_platform_interface flutter flutter_web_plugins meta] - sky_engine 0.0.99 - source_span 1.5.5 [charcode path term_glyph] - stack_trace 1.9.3 [path] - stream_channel 2.0.0 [async] - string_scanner 1.0.5 [charcode meta source_span] - term_glyph 1.1.0 - test_api 0.2.11 [async boolean_selector collection meta path pedantic source_span stack_trace stream_channel string_scanner term_glyph matcher] - transformer_page_view 0.1.6 [flutter] - typed_data 1.1.6 - url_launcher 5.7.2 [flutter url_launcher_platform_interface url_launcher_web url_launcher_linux url_launcher_macos url_launcher_windows] - url_launcher_linux 0.0.1+1 [flutter] - url_launcher_macos 0.0.1+8 [flutter] - url_launcher_platform_interface 1.0.8 [flutter meta plugin_platform_interface] - url_launcher_web 0.1.4+1 [url_launcher_platform_interface flutter flutter_web_plugins meta] - url_launcher_windows 0.0.1+1 [flutter] - vector_math 2.0.8 - xml 3.5.0 [petitparser collection convert] ```

markusaksli-nc commented 3 years ago

Hi @kushksolves Supporting older flutter versions by adding code like this to the SDK is not a priority for either Flutter itself or Flutter plugin owners. The April release you are using is heavily outdated at this point and there would be no guarantee that a number of other issues couldn't crop up (that have either been fixed in the Flutter framework or engine).

You could view this more as another sign of the burdens of not upgrading your Flutter version. The official stance here is to even try your app out on the beta releases:

If you’re already shipping a Flutter app based on the stable channel, we encourage you to test your app on beta candidate releases and influence the quality of the stable release by reporting any issues.

(from Flutter Spring 2020 Update)

Due to these reasons I'm going to close this issue. If you disagree please write in the comments and let me know. Thank you