Skip to content

Instantly share code, notes, and snippets.

@AbbasHoseini
Created December 9, 2021 09:55
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 AbbasHoseini/382ab714ef755fbe32470ee75d807f9b to your computer and use it in GitHub Desktop.
Save AbbasHoseini/382ab714ef755fbe32470ee75d807f9b to your computer and use it in GitHub Desktop.
return Consumer<CartModel>(
builder: (context, cart, child) => Stack(
children: [
// Use SomeExpensiveWidget here, without rebuilding every time.
if (child != null) child,
Text("Total price: ${cart.totalPrice}"),
],
),
// Build the expensive widget here.
child: const SomeExpensiveWidget(),
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment