import 'package:cloud_firestore_web/cloud_firestore_web.dart';
import 'package:firebase_analytics_web/firebase_analytics_web.dart';
import 'package:firebase_auth_web/firebase_auth_web.dart';
import 'package:firebase_core_web/firebase_core_web.dart';
import 'package:fluttertoast/fluttertoast_web.dart';
import 'package:google_sign_in_web/google_sign_in_web.dart';
import 'package:pak_farmer/models/Register.dart';
import 'package:shared_preferences_web/shared_preferences_web.dart';
import 'package:flutter_web_plugins/flutter_web_plugins.dart';
// ignore: public_member_api_docs
void registerPlugins(Registrar registrar) {
FirebaseFirestoreWeb.registerWith (registrar);
FirebaseAnalyticsWeb.registerWith(registrar);
FirebaseAuthWeb.registerWith(registrar);
FirebaseCoreWeb.registerWith(registrar);
FluttertoastWebPlugin.registerWith(registrar);
GoogleSignInPlugin.registerWith(registrar);
SharedPreferencesPlugin.registerWith(registrar);
registrar**.registerMessageHandler();**
}
I've written this code but it is giving me an error on the last line:
The method 'registerMessageHandler' isn't defined for the type 'Registrar'.
The method 'registerMessageHandler' isn't defined for the type 'Registrar'. Show activity on this post. Show activity on this post. flutter clean didn't work for me. My problem was that I made the project in the Flutter beta channel and then opened in the stable channel. When I switched back to beta it was OK.
The method (methodName) undefined for the type (className) Specific errors The method contains(String) is undefined for the type String The method codePointAt(String) is undefined for the type String
The method format(String) is undefined for the type String The method getTypeParameters(typeVariable) is undefined for the type typeVariable
This error message appears in java when the method is not defined in that class. If you getting these errors for methods related to String or Collection Classes most likely the problem is because of JDK compliance level or installed JRE. All these methods compiles with JDK 1.5 or above.
my error gone with flutter clean once and it will work fine for me
flutter clean
didn't work for me. My problem was that I made the project in the Flutter beta channel and then opened in the stable channel. When I switched back to beta it was OK. Once web support enters stable this shouldn't be a problem anymore.
I faced the same issue when I downgraded Flutter from 2.0.0+
to 1.22.6
. Developed the web panel in 2.0.0+
but after downgrading it for another app, saw this.
The error is likely if you created the project in stable version and for some reason you downgraded to a lower Flutter version.
FIX: Upgrade to the higher / updated version OR check the channel it was built on and shift to that channel.
You can see which channel you are currently on with flutter channel
in your cmd.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With