I am trying to add native ads using the plugin flutter_native_admob but I always get this error:
E/flutter ( 6504): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: MissingPluginException(No implementation found for method initialize on channel flutter_native_admob)
E/flutter ( 6504): #0 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:319:7)
E/flutter ( 6504): <asynchronous suspension>
E/flutter ( 6504): #1 NativeAdmob.initialize (package:flutter_native_admob/flutter_native_admob.dart:105:20)
E/flutter ( 6504): #2 HomePageState.initState (package:spanglishcards/view/card/HomePage.dart:67:19)
E/flutter ( 6504): #3 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4355:58)
I tried to add it in my Home page:
class HomePage extends StatefulWidget {
HomePage({
this.user,
});
final User user;
@override
State<StatefulWidget> createState() => HomePageState();
}
class HomePageState extends State<HomePage> {
final _nativeAdmobs = NativeAdmob();
Future initState() {
super.initState();
_nativeAdmobs.initialize(appID:"ca-app-pub-XXX~XXX" );
}
}
And also in the main.dart:
final _nativeAdmobs = NativeAdmob();
void main(){
WidgetsFlutterBinding.ensureInitialized();
_nativeAdmobs.initialize(appID:"ca-app-pub-XXX~XXX" );
runApp(MyApp());
}
I also tried to run flutter clean / flutter run before just in case, but it doesn't work either. Any solution?
To discard issues with my appID, the plugin firebase_admob (doesn't support native ads) works.