Skip to content

Instantly share code, notes, and snippets.

@slamdon
Created February 23, 2020 12:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save slamdon/511964f69b6a646658619a2270307cb4 to your computer and use it in GitHub Desktop.
Save slamdon/511964f69b6a646658619a2270307cb4 to your computer and use it in GitHub Desktop.
Provider
final _cart = Provider.of<CartProvider>(context);
...
FlatButton(
child: Text(
"${_cart.products.length}",
style: TextStyle(color: Colors.white, fontSize: 20),
),
onPressed: () {
Navigator.push(context, MaterialPageRoute(builder: (context){
return CartPage(_cart.products);
}));
},
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment