Managing State in Flutter

Sep 22 2022 · Dart 2.17, Flutter 3.0, Android Studio Chipmunk

Part 2: Use Provider

12. Use Context Methods

Episode complete

Play next episode

Next
About this episode
Leave a rating/review
See forum comments
Cinema mode Mark complete Download course materials
Previous episode: 11. Use a Change Provider Next episode: 13. Understand Consumers

Get immediate access to this and 4,000+ other videos and books.

Take your career further with a Kodeco Personal Plan. With unlimited access to over 40+ books and 4,000+ professional videos in a single subscription, it's simply the best investment you can make in your development career.

Learn more Already a subscriber? Sign in.

Heads up... You’re accessing parts of this content for free, with some sections shown as obfuscated text.

Heads up... You’re accessing parts of this content for free, with some sections shown as obfuscated text.

Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan.

Unlock now

So far, we’ve getting our model objects by calling the Provider.of method. This gives us access to our model object, but Provider has actually made getting our objects far easier. By using extension methods, we don’t need to call Provider.of, we can use extension methods defined on the context. There are three methods available to us.

final pillar = context.watch<Pillar>();
final pillar = context.watch<Pillar>();