This AdWidget is already in the Widget tree error in flutter

Viewed 315

I am using google_mobile_ads: ^0.13.5 package and also tried giving unique id but still gets this Error:- This AdWidget is already in the Widget tree If you placed this AdWidget in a list, make sure you create a new instance in the builder function with a unique ad object. Make sure you are not using the same ad object in more than one AdWidget. And Error takes me to AdWidget.

The code I am trying:-

  final adContainer = Container(
       alignment: Alignment.center,
       width: double.infinity,
       height: 70,
       child: Card(
       color: white,
      child: Container(
        padding: EdgeInsets.symmetric(vertical: 5.0, horizontal: 0.0),
    child: AdWidget(
    key: new UniqueKey(),
    ad: myPollsData[index] as BannerAd,
     ),),);
       return StatefulBuilder(
           builder: (context, setS){
           return adContainer;
         },);

                         
                              
                           
0 Answers
Related