Reputation: 4987
The getter 'instance' isn't defined for the type 'FirebaseMessaging'. Try importing the library that defines 'instance', correcting the name to the name of an existing getter, or defining a getter or field named 'instance'.
I am trying to implement this sample code
https://github.com/FirebaseExtended/flutterfire/blob/master/packages/firebase_messaging/firebase_messaging/example/lib/main.dart
But it is showing above mentioned error.
How to fix it?
firebase_messaging: ^7.0.3
import 'package:firebase_messaging/firebase_messaging.dart';
Upvotes: 1
Views: 3864
Reputation: 4210
The getter 'instance' is not available on firebase_messaging: ^7.x.x
, you will need to upgrade to version 8
Upvotes: 1