Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undefined class NativeAdmobOptions #29

Closed
Errechydy opened this issue Mar 31, 2020 · 4 comments
Closed

Undefined class NativeAdmobOptions #29

Errechydy opened this issue Mar 31, 2020 · 4 comments

Comments

@Errechydy
Copy link

Thanks for this great plugin
I wanted to use NativeAdmobOptions as you explained in this example but i got this error :

Undefined class 'NativeAdmobOptions'.

I'm using last version 2.1.0

@korchix
Copy link

korchix commented Mar 31, 2020

@Errechydy please share the code you'r using, to let the people help you.

@Errechydy
Copy link
Author

@korchix The error has nothing to do with the code, it says Undefined class 'NativeAdmobOptions'., which mean no matter what code you use you will get that error. it's like the NativeAdmobOptions method doesn't exist in the plugin at all and you're trying to use it.

To reproduce the error you can use the exact same example that exist in the github, copy past the example and add the NativeAdmobOptions you will get the error, her is an example:

import 'package:flutter/material.dart';
import 'package:flutter_native_admob/flutter_native_admob.dart';
import 'package:flutter_native_admob/native_admob_controller.dart';

void main() => runApp(MyApp());

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  static const _adUnitID = "ca-app-pub-3940256099942544/8135179316";

  final _nativeAdController = NativeAdmobController();

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: 
            Container(
              height: 90,
              child: NativeAdmob(
                adUnitID: _adUnitID,
                controller: _nativeAdController,
                type: NativeAdmobType.banner,
                options: NativeAdmobOptions(
                  ratingColor: Colors.red,
                ),
              ),
            )
        ),
    );
  }
} 

If you comment the NativeAdmobOptions the code will work

@korchix
Copy link

korchix commented Mar 31, 2020

@Errechydy i see. you have to import the native_admob_options.dart too

import 'package:flutter_native_admob/native_admob_options.dart';

@Errechydy
Copy link
Author

Errechydy commented Mar 31, 2020

@korchix Thanks, it would be better if that was mentioned in the part that talks about NativeAdmobOptions in Readme

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants