'How to count the number of items in a section of the bottom navigation bar in flutter

I am developing a flutter application for a project of my studies. It is a click and collect application. I would like to add on the icon of the basket, the number of products inside, such as this :

example of icon

I look a forum on internet but I didn't find anything, I find just a tuto for make a nav bar



Solution 1:[1]

Use Badge Package: Here In this package you can add animation and much more...

Solution 2:[2]

You're looking for the Badge package.

Add as dependency via terminal

flutter pub add badges

Import and refer to docs for more customization.

import 'package:badges/badges.dart';
...
Badge(
  badgeContent: const Text('Hello'),
  child: const Icon(
    Icons.abc
 ),
),
...

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Hammad Ali
Solution 2 jbmcle