Search code examples
flutterbadge

flutter: No named parameter with the name 'clipBehavior', clipBehavior: Clip.none


I am trying to add a notifications counter badge with using badges package with flutter but the project does not compile as soon as I add the below code. I'm using flutter v1.17.4.

Badge(
  badgeColor: Colors.deepOrangeAccent,
  toAnimate: true,
  child: IconButton(
   icon: Icon(Icons.shopping_cart),
   onPressed: (){
    Navigator.push(context, MaterialPageRoute(builder: (context)=> ShoppingCart()));
   }
 )
),

When start debugging, flutter: No named parameter with the name 'clipBehavior', clipBehavior: Clip.none displays. Is there any possible solution without Updating the version of flutter to latest version?


Solution

  • The error is not from the Flutter framework but from the older version of Badge package that you are using. The author of Badge has updated the package on December 8, 2020 with precise the same bug fix.

    [1.1.6] - [December 8, 2020]

    Fix error parameter with the name 'clipBehavior'

    Please upgrade the Badge package to its latest version Badges 1.1.6.