Using Extension Methods for the Provider data lookup - Flutter in Practice 45

preview_player
Показать описание
Dart 2.7 adds the extension methods. This feature allows to add new members (not only methods) to existing types. Such methods can be invoked like regular methods even though they are just static functions. What's funny here is that you can define extension methods not only for instance methods, but also for operators, setters and getters (but not for fields). The more adapted name would be the extension members. The Dart team, however, decided to name this feature similarly to other programming languages so that it sounds more familiar.

In Flutter, we can use the extension methods to simplify the way of looking up the Provider data in the widget tree.

Рекомендации по теме
Комментарии
Автор

Happily watching your tutorial I will definitely try this sprinkle framework made for happy programmers.

smartyin
Автор

I just finished watching all ur series. U r by far best of the best..

rizwanmumtaz
Автор

Where is a good clean place to store extension methods?

noskap
Автор

Hi, would you share the vsc scheme colors with our?

tutkuns
Автор

One request sir plz plz plz.. Continue this series and add authentication in ur sprinkle framework code.. Nd make a git repository for a flutter starter project.

I was unable to do it myself, i undestand getting data out of stream fully but putting data into stream and passing authenticated user down the tree, i messed up.

So plz plz and plz.

rizwanmumtaz
Автор

Seems he's following the trend of making breaking changes..
Instead of passing the map of manager factories in the constructor, you have to call the register function like so:
Overseer overseer = Overseer()
.register<ContactManager>(() => ContactManager())
.register<CounterManager>(() => CounterManager())
=> MessageFormManager());

KayronDeacon