Managing State with the Scoped Model Pattern in Dart's Flutter Framework

preview_player
Показать описание
In this tutorial, we take a look at the scoped model pattern/plugin with flutter by building two counter applications.

Feel free to donate:
ETH: 0x03247265dd5242605bD2FA3c40fb3b70d9e3D685
Рекомендации по теме
Комментарии
Автор

Thank you. Your explanation and demo are very clear to follow and understand. I have been watching some Pluralsight courses and I just could not make sense of it. Now I finally get it. Thank you again.

Coffeecupdev
Автор

It seems every time I want to learn a new concept, I have to go through a half-dozen examples to find the one that works for me. This one works for me. Thanks for the github link.

mariefast
Автор

Amazing! Thank you so much for the clear explanation. I love that you gave a simple way example and then a more complex example which is really helpful in helping me understand.

yangyang
Автор

Loving your tutorials, really learning a lot, just a quick note if you need a minus icon then Icons.remove looks a lot better than Icons.minimize

roidyrock
Автор

Awesome as always. Thanks Tensor. This way of app state management was to me much easier to understand and use. Also looks like less boilerplate coding as with Redux approach.

flastrMan
Автор

This seems to be the best way so far to manage global state. Thank you for the tutorials, I love it.
BTW, is your name really Tensor? Nice!

KashifMinhaj
Автор

Man.. Thank you so much for the explanation !

operamini
Автор

Hello Tensor and thank you for this, and your many other Flutter tutorials. I am new to Flutter, and am trying to develop a multipage app. In short: main.dart has a 'home' of a separate welcome_page.dart (in its own file). That page, and the two other 'top level' pages all include a 'drawer' widget. The drawer widget allows navigation to the 3 (for now) pages. The drawer widget also calls up the sign_in_page.dart or register_page.dart. I would like to keep the 'signed in' aspects (memberID, isSignedIn, etc...) in 'global state' and your scoped model makes sense. That said, I have been unable to 'set up' all of the elements/files, let alone use them. When a user signs in, I want the sign_in_page.dart to 'notify' all the other pages that care, and, for those pages to have access to the shared/scoped data bits. Please let me know how I can ask you to help a bit or what I can do to more adequately describe the issues I am having. I did see that you are working on a multi-page example, and that might help. Thank you.

davidbaron
Автор

Why all flutter tutorials always talk about counter app (everywhere on the internet)? Why do we need state management for counter app really simple like this? Why not focusing on real world app?

pippop
Автор

omg thank you, i was just able to solve a verryy anoying bug with your video!

Lukas-cmyd
Автор

This looks like Redux but simpler. Perhaps it's better to use Scoped Model instead of Redux with Flutter. What do you think?

westiti
Автор

Correct me if I understood wrongly. Using ScodedModel separates the states (data) from the widget builder. Without using it we would use setState() to rerun the build() in order for any changes in states to be reflected on the screen. With ScopedModel, how does the display reflect the change in state?

jackedelic
Автор

​ @Tensor Programming What pattern did you find more useful for building CRUDs and what pattern do you use for your apps more often or which one do you prefer?

kushtra
Автор

If I wanted to use a scoped model for a http request like SWAPI, how would I go about doing that? Would I have to use a future? As for the action would a onPressed work to call? I'm a noob sorry!

kickeddroid
Автор

Thank you for the great tutorial, its hard learning frameworks just from the documentation. I am trying to understand the AnimatedList widget, could you perhaps do a tutorial about that? Keep up with the great videos.

ghsu
Автор

What purpose does the 'Key' variable serve? I see that if I add it in the constructor it will insert a random key object, but I have no clue what it references. Even passing null will work just fine for the key.

Silmarilos
Автор

Is it possible to pass any data text/int, to a field of a model class in scoped_model? From an onPressed function? b'cos it doesn't accept methods/function with parameters.

antd
Автор

Hi Tensor, thank you for explaining this.
Does it make sense if I create some factory instances in inside the AppModel and use the instance in some different widgets so as to sync my data somewhere else in my app?

zaynjarvis
Автор

Thanks for the tutorial. Really helpful. Would you typically have one scoped model for the whole app or several? I tried creating one that wasn't at the top level of the app (in one of my sub-pages) but on screen orientation changes the widget gets redrawn and the model gets recreated. If I move it to the main top level then it'll persist screen orientation changes. Any suggestions on how to have a model that persists that's not created at the top level?

AndrewMooreReactle
Автор

what's the difference between scoped_model below materialapp and scoped_model above material app? what's the advantage and disadvantage between these 2 implementations?

delosssh
visit shbcf.ru