FlutterFirebaseMessagingBackgroundService and FlutterFirebaseMessagingPlugin unresolved

Viewed 670

i have the following code:

package com.example.firebase_notification

import io.flutter.app.FlutterApplication
import io.flutter.plugin.common.PluginRegistry
import io.flutter.plugins.GeneratedPluginRegistrant
import io.flutter.plugins.firebase.messaging.FlutterFirebaseMessagingBackgroundService
import io.flutter.plugins.firebase.messaging.FlutterFirebaseMessagingPlugin

class Application: FlutterApplication(), PluginRegistry.PluginRegistrantCallback {
    override fun onCreate() {
        super.onCreate()
        FlutterFirebaseMessagingBackgroundService.setPluginRegistrant(this)
    }
    override fun registerWith(registry:PluginRegistry) {
        FlutterFirebaseMessagingPlugin.registerWith('registry')
    }
}

It's about a Firebase push messaging. I have a problem that some references, as stated in the title, cannot be resolved. My pubspec.yaml looks like this:

dependencies:
  flutter:
    sdk: flutter

  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^1.0.2
  firebase_messaging: ^9.1.1
  firebase_core: ^1.0.3
  flutter_local_notifications: ^5.0.0+1

I've tried other versions of firebase_messaging and firebase_core. Unfortunately no change to the error message. I work with Android Studio. PluginRegistrantCallback is deprecated too.

Thanks

0 Answers
Related