Skip to content

[firebase_messaging]: 16.4.2 fails to compile, FirebasePlugin type not found in any published firebase_core_platform_interface #18438

Description

@heyuforia

Is there an existing issue for this?

  • I have searched the existing issues.

Which plugins are affected?

Messaging

Which platforms are affected?

Android

Description

firebase_messaging 16.4.2 does not compile. FirebaseMessaging extends a base class named FirebasePlugin, but no published firebase_core_platform_interface defines that type. Any resolve that lands on 16.4.2 fails at build time:

firebase_messaging-16.4.2/lib/src/messaging.dart:11:33: Error: Type 'FirebasePlugin' not found.
class FirebaseMessaging extends FirebasePlugin {
                               ^^^^^^^^^^^^^^
firebase_messaging-16.4.2/lib/src/messaging.dart:21:36: Error: The getter 'pluginConstants' isn't defined for the type 'FirebaseMessaging'.
        app: app, pluginConstants: pluginConstants);
                                   ^^^^^^^^^^^^^^^
Target kernel_snapshot_program failed: Exception

What changed between 16.4.1 and 16.4.2:

16.4.1:  class FirebaseMessaging extends FirebasePluginPlatform   // compiles
16.4.2:  class FirebaseMessaging extends FirebasePlugin           // does not compile

firebase_messaging.dart pulls FirebasePlugin via show FirebasePlugin from firebase_core_platform_interface, but:

  • firebase_core_platform_interface latest is 7.1.0, and it defines only FirebasePluginPlatform (extends PlatformInterface). No published version defines FirebasePlugin.
  • firebase_core 4.12.0, which is 16.4.2's declared minimum, exports no Dart FirebasePlugin either.
  • 16.4.2 constrains firebase_core_platform_interface: ^7.1.0, which resolves to 7.1.0 and lacks the symbol.

It looks like the FirebasePluginPlatform to FirebasePlugin rename shipped in the 16.4.2 publish, but the matching firebase_core_platform_interface release that actually defines FirebasePlugin was never published, or the constraint was not bumped to require it. 16.4.1 still extends FirebasePluginPlatform and compiles fine.

Reproducing the issue

  1. Use any pubspec whose version range admits firebase_messaging 16.4.2.
  2. Run flutter pub get. It resolves firebase_messaging 16.4.2, firebase_core 4.12.0, firebase_core_platform_interface 7.1.0.
  3. Run flutter build for any target. Compilation fails with the errors above.

Workaround: pin firebase_messaging: 16.4.1.

Firebase Core version

4.12.0

Flutter Version

3.44.5 (stable), Dart 3.12.2

Relevant Log Output

firebase_messaging-16.4.2/lib/src/messaging.dart:11:33: Error: Type 'FirebasePlugin' not found.
class FirebaseMessaging extends FirebasePlugin {
                               ^^^^^^^^^^^^^^
firebase_messaging-16.4.2/lib/src/messaging.dart:21:36: Error: The getter 'pluginConstants' isn't defined for the type 'FirebaseMessaging'.
 - 'FirebaseMessaging' is from 'package:firebase_messaging/firebase_messaging.dart'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'pluginConstants'.
        app: app, pluginConstants: pluginConstants);
                                   ^^^^^^^^^^^^^^^
Target kernel_snapshot_program failed: Exception

Flutter dependencies

Expand Flutter dependencies snippet
firebase_core 4.12.0
firebase_core_platform_interface 7.1.0
firebase_core_web 3.9.0
firebase_messaging 16.4.2
firebase_messaging_platform_interface 4.9.1
firebase_messaging_web 4.2.2

Additional context and comments

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions