Managing State with the Scoped Model Pattern in Dart's Flutter Framework
utopian-io·@tensor·
0.000 HBDManaging State with the Scoped Model Pattern in Dart's Flutter Framework
#### What Will I Learn? - You will learn how to make use of the scoped model pattern/plugin - You will learn how to manage state in your widget tree - You will learn how to create multiple instances of the same model - You will learn how to build out flutter models #### Requirements - [IDEA intellij](https://www.jetbrains.com/idea/) or [Visual Studio Code](https://code.visualstudio.com/) with the Dart/Flutter [Plugins](https://github.com/flutter/flutter-intellij) - The [Dart SDK](https://www.dartlang.org/install) and the [Flutter SDK](https://flutter.io/get-started/install/) - A fair understanding of Mobile development and Imperative or Object Oriented Programming #### Difficulty - Intermediate #### Description In this **Flutter video tutorial**, we take a look at the **Scoped Model Plugin**. The **Scoped Model Plugin** originated as a pattern found in **Google's** upcoming **Fuchsia OS** repository. **Fuchsia** makes use of **Flutter** in many of its **native widgets** and the **Scoped Model pattern** is used heavily in these widgets to manage their state. The **Scoped Model pattern** was transplanted from the **Fuchsia repository** into a plugin that can be used in other Flutter projects. This plugin is also the **basis** for the implementation of **Flutter Redux** that we looked at in an earlier tutorial. Making use of the power of **inherited widgets** and **Flutter's widget tree**, **Scoped Model injects** a model into an upstream area of the user interface. We can then access this model from any widget that is *below* the initial **Scoped Model Widget injection**. In this way, we can also **inject multiple models** in different parts of the application which lets us isolate and **organize** the **business logic and state** of our applications. In this specific tutorial, we start by looking at a fairly basic counter example. The counter example features one single counter that can be incremented or decremented. The model and state for this application is added into the User interface through the Scoped Model injection method. The tree for this first application is fairly linear and basic. We then move on to modularize the counter widget so that we can create multiple counters in the next application. This second counter application has a more complex widget tree and features multiple instances of the model. This application helps to display how we can maintain the state of multiple widgets without having to use a Stateful widget pattern. The source code for this project can be found [here](https://github.com/tensor-programming/flutter_scoped_tutorial) #### Video Tutorial <iframe width="560" height="315" src="https://www.youtube.com/embed/-MCeWP3rgI0" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe> #### Curriculum - [Dart Flutter Cross Platform Chat Application Tutorial](https://steemit.com/@tensor/dart-flutter-cross-platform-chat-application-tutorial) - [Building a Multi-Page Application with Dart's Flutter Mobile Framework](https://utopian.io/u/36304896) - [Making Http requests and Using Json in Dart's Flutter Framework](https://utopian.io/u/36711012) - [Building Dynamic Lists with Streams in Dart's Flutter Framework](https://utopian.io/u/36947451) - [Using GridView, Tabs, and Steppers in Dart's Flutter Framework](https://utopian.io/u/37160274) - [Using Global Keys to get State and Validate Input in Dart's Flutter Framework](https://utopian.io/u/37555657) - [The Basics of Animation with Dart's Flutter Framework](https://utopian.io/u/37731908) - [Advanced Physics Based Animations in Dart's Flutter Framework](https://utopian.io/u/38077640) - [Building a Drag and Drop Application with Dart's Flutter Framework](https://utopian.io/u/38246831) - [Building a Hero Animation and an Application Drawer in Dart's Flutter Framework](https://utopian.io/u/38433382) - [Building a Temperature Conversion Application using Dart's Flutter Framework](https://utopian.io/u/38673252) - [Using Inherited Widgets and Gesture Detectors in Dart's Flutter Framework](https://utopian.io/u/38862139) - [Using Gradients, Fractional Offsets, Page Views and Other Widgets in Dart's Flutter Framework](https://utopian.io/u/39001452) - [Building a Calculator Layout using Dart's Flutter Framework](https://utopian.io/u/39348292) - [Finishing our Calculator Application with Dart's Flutter Framework](https://utopian.io/u/39522895) - [Making use of Shared Preferences, Flex Widgets and Dismissibles with Dart's Flutter framework](https://utopian.io/u/39694109) - [Using the Different Style Widgets and Properties in Dart's Flutter Framework](https://utopian.io/u/39890067) - [Composing Animations and Chaining Animations in Dart's Flutter Framework](https://utopian.io/u/40065925) - [Building a Countdown Timer with a Custom Painter and Animations in Dart's Flutter Framework](https://utopian.io/u/40384708) - [Reading and Writing Data and Files with Path Provider using Dart's Flutter Framework](https://utopian.io/u/40536227) - [Exploring Webviews and the Url Launcher Plugin in Dart's Flutter Framework](https://utopian.io/u/40707081) - [Building a Movie Searcher with RxDart and SQLite in Dart's Flutter Framework (Part 1)](https://utopian.io/u/41053969) - [Building a Movie Searcher with RxDart and SQLite in Dart's Flutter Framework (Part 2)](https://utopian.io/u/41208913) - [Building a Movie Searcher with RxDart and SQLite in Dart's Flutter Framework (Part 3, Final)](https://utopian.io/u/41384278) - [Adding a Real-time Database to a Flutter application with Firebase](https://utopian.io/u/41791441) - [Building a List in Redux with Dart's Flutter Framework](https://utopian.io/u/41963715) <br /><hr/><em>Posted on <a href="https://utopian.io/utopian-io/@tensor/managing-state-with-the-scoped-model-pattern-in-dart-s-flutter-framework">Utopian.io - Rewarding Open Source Contributors</a></em><hr/>
👍 tensor, tjonathan426, freyman, makeme, sbi2, rantar, josephace135, luoq, cmp2020, cub1, lisa.palmer, remlaps1, clayjohn, steemstem, lemouth, anarchyhasnogods, followbtcnews, joseg, planetenamek, felixrodriguez, simplifylife, mayowadavid, erodedthoughts, enzor, robotics101, sco, adetola, terrylovejoy, rionpistorius, de-stem, justtryme90, fredrikaa, abigail-dantes, mountain.phil28, dysfunctional, monie, deutsch-boost, ksolymosi, the-devil, juanjdiaz89, jamhuery, foundation, churchboy, himal, zeeshan003, pangoli, lamouthe, rachelsmantra, sakura1012, samminator, nitesh9, kerriknox, pearlumie, gra, chloroform, dexterdev, rjbauer85, kryzsec, dna-replication, curie, liberosist, meerkat, dber, amavi, markangeltrueman, tantawi, locikll, aboutyourbiz, cryptokrieg, erangvee, slickhustler007, justdentist, gabox, spectrums, xanderslee, gentleshaid, chimtivers96, dashfit, pacokam8, oscarcc89, blessing97, wanderingdanish, chillingotter, hendrikdegrote, sethroot, galberto, mahdiyari, bobdos, carloserp-2000, kenadis, echavez82, niouton, anwenbaumeister, jordanx2, hadji, kushed, pharesim, mrs.agsexplorer, timsaid, alexander.alexis, ovij, grandpere, timothyb, tormiwah, infinitelearning, steem-id, steemedia, velourex, cebymaster, cotidiana, robertvogt, dreamien, hatuvera, benleemusic, positiveninja, steemulator, cgbartow, coloringiship, cryptotradingfr, jpchabry, thatterrioguy, dynamicrypto, aotearoa, theunlimited, rayhanahmed, torfian, qurator, gregory-f, oleg326756, scrooger, samiwhyte, mwfiae, recordpool, shadowspub, theleapingkoala, peppermint24, anomalogy, blacklux, fishyculture, iwanderela, mkt, buckydurddle, mirkosche, cifer, greenorange, loshcat, lafona-miner, mdnazmulhasan, utopian-io, humanduck, qadri.mag, musicayfarandula, bobsthinking,