Questions tagged [scoped-model]

A Flutter library that allow you to easily pass a data Model from a parent Widget down to its descendants. In addition, it also rebuilds all of the children that use the model when the model is updated.

47 questions
19
votes
1 answer

Scoped Model, BLoC pattern, StreamBuilder and Inherited Widget(or Model) which one should I chose and why?

I think I have now at least a vague idea of how to use a BLoC, Stream Builder and Inherited Widget(or Model) in my app (nothing special, but for me it took time), but playing with the Scoped Model I had a sort of existential crisis: I feel they can…
8
votes
2 answers

Using Scoped Model to maintain app state in flutter

I need help creating the architecture for my application. I am using Flutter and scoped_model to maintain state. It's an application that has a login, that displays news in one part of the application, and shows a photo gallery among others. I would…
Pongal
  • 95
  • 1
  • 7
5
votes
2 answers

Access child widget's variable in parent widget (Flutter with Dart)

I have a button which when pressed opens a modal bottom sheet. The sheet has a form widget that takes few text fields and an image (from gallery/camera). For this image input, I have created another stateful widget which is called in the previous…
Jagrati Gogia
  • 221
  • 1
  • 3
  • 12
5
votes
3 answers

Flutter Error: Could not find the correct ScopedModel

I am trying to create a scopedmodel in my flutter project and I can't seem to figure out why I get the error. What is wrong in this scopedmodel implementation? I have a home page with bottom navigator. Inside the profile tab, I fetch the list of…
Shruthi
  • 293
  • 1
  • 3
  • 11
4
votes
1 answer

How to Build All elements of sliverlist once?

I'm making a screen with comments section that has comments & their sub comments. I use ScopedModel for managing state of the screen. The data for comments is in a List<-model-> and for subcomments are inside the model->List<-model->. this data is…
Taosif7
  • 325
  • 1
  • 3
  • 9
3
votes
0 answers

Passing Scoped Model as Function Argument vs Using ScopedModelDescendant

What is the recomended way to use ScopedModel in functions? Should i pass the model as an argument or should i always use ScopedModelDescendant wherever i used the model? Using ScopedModelDescendant: class Foo extends StatelessWidget { Widget…
Pionix
  • 413
  • 2
  • 8
2
votes
0 answers

how to implement scoped model to navigation screen when scoped model initialized in the previous screen and not in myApp()

im trying to use scoped model in 2 screens in the app and i dont want to run the app with scoped model, i just initialize scoped model in first screen and it worked but i got an error in the second screen where i navigate to it. so what do i…
isso kd
  • 369
  • 3
  • 16
2
votes
0 answers

Consume model property from another nested model in Flutter

How can I use consumer to access data of a ViewModel class from a nested models class? I know we can use ChangeNotifierProvider and Consumer to access the view Model from a widget. But I'm trying to access the properties from a model class that…
Marteiro
  • 165
  • 1
  • 7
2
votes
0 answers

Make a App wide progress bar (Across the pages of whole app) and manage its state as required in Flutter using provider

Im trying to make a Custom Progress Indicator widget which i can show or hide in any of the pages(Anywhere across the app). My approach is to bind a provider value for the progress widget and toggle the value as required. But I just don't get where…
Nikhil N
  • 21
  • 1
2
votes
2 answers

Flutter - Application Wide Notifications

Is there a correct way to listen to a stream / scoped model from a 'root' page or location in a Flutter app and upon receiving some data display an appropriate notification (e.g. Snackbar) on any currently open page (may not be the home page)? I'd…
user6635665
  • 337
  • 3
  • 15
2
votes
1 answer

Navigator push same screen multiple times

I need push new screen automatic on app startup (if user is login or sign out). I am use scoped_model for auth so need navigate when user value is change in model. I am follow Brian Egan suggestion here:…
FlutterFirebase
  • 2,163
  • 6
  • 28
  • 60
2
votes
2 answers

unable to use scoped model in flutter bottom sheet,dialogs

when i run this code it shows an error that correct scopedmodel was not found. i think we have to declare another scoped model for bottomsheet,dialogs also did that using with same model but it behaving abnormally. how do i achive that how to use…
2
votes
3 answers

Flutter Using Multiple Models with Scoped Model

I'm trying to build an Expense tracker App in Flutter and has decided to use Scoped Model for state management. The App has a User who can have many Accounts and each account can have many Transactions. How do I model these to be used with Scoped…
Aswin Mohan
  • 952
  • 1
  • 11
  • 26
1
vote
1 answer

How to manage multi page form state with scoped model in flutter

I have a multi page form that I need to manage state with. I am currently trying to use the scoped model but it's not working. Everything I go to another page the state is cleared. I'm usually the PageView widget to create the multi page form. What…
Ghost
  • 45
  • 1
  • 8
1
vote
0 answers

Force MaterialApp "home" to be rebuild

I'm using the technique from this SO answer to "restart" my app. The problem is that the "home" page of my MaterialApp doesn't get recreated (it's initState is not executed on restart). For this to happen, I have to briefly return something else…
Magnus
  • 17,157
  • 19
  • 104
  • 189
1
2 3 4