Get immediate access to this and over 1,500+ other videos and books.

Boost your skills with a Beginner subscription. With over 60+ video courses and our core foundational programming books bundled in one subscription, it’s simply the best investment you can make in your development career.

Understand Consumers

This video was last updated on Sep 22 2022

In this episode, learn how to leverage the consumer which unwraps your objects from a Provider, saving you some code.


Heads up... You've reached locked video content where the transcript will be shown as obfuscated text.

You can unlock the rest of this video course, and our entire catalogue of books and videos, with a Professional subscription.

So far, we’ve been getting a reference to our data object and then simply used it in our builder method. If this is all you are doing, you can opt to use a Consumer instead. A consumer gets your data from the Provider and unwraps it for you to use in a builder method.

Widget build(BuildContext context) {
    return Consumer<Pillar>(
        builder: (_, pillar, __) => Column(
            children: <Widget>[
                const Center(
                child: TutorialWidget(),
                padding: const EdgeInsets.only(top: 24.0),
                child: Text(
                    'Total Tutorials: ${pillar.articleCount}',
                    style: const TextStyle(fontSize: 30, fontWeight: FontWeight.bold),
return Consumer<Pillar>(builder: (_, pillar, __) {
    return Stack(
    children: [
        onTap: () {
        child: Image.asset('assets/images/${pillar.type.imageName}',
            width: 110, height: 110),
        bottom: 2,
        child: CircleAvatar(
            child: Text(pillar.articleCount.toString()),