Why sometimes context is being replace as underscore or "_"?

Viewed 109

So recently I'm studying provider state management, and sometimes the instructor replacing context with a "_" or underscore.

For example when we are initializing the the changenotifierProvider:

 ChangeNotifierProvider(
            create: (_) => ProductProvider(),
          ),

Another Example when we are trying to initialize a consumer:

Consumer<CartProvider>(
            builder: (_, cartProvider, child) {
              return Badge(
                child: child,
                value: cartProvider.itemCount
                    .toString(), 
              );
            },
            child: IconButton(
              icon: Icon(Icons.shopping_cart),
              onPressed: () {
                Navigator.pushNamed(context, CartScreen.routeName);
              },
            ),
          )

What kind of use cases that context is important in provider state management scenarios or others?

1 Answers
Related