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.
Questions tagged [scoped-model]
47 questions
0
votes
1 answer
ScopedModel - how to pass more than one model
In sample we pass the single model like this
return ScopedModel(
model: CounterModel(), // only one model here
child: MaterialApp(
title: 'Scoped Model Demo',
home: CounterHome('Scoped Model Demo'),
),
);
How to pass…

rozerro
- 5,787
- 9
- 46
- 94
0
votes
1 answer
ScopedModelDescendant raises NoSuchMethodError
Output Error:
The following NoSuchMethodError was thrown building ScopedModelDescendant(dirty, dependencies: [_InheritedModel]):
The getter 'sampleVariable' was called on null.
Receiver: null
Tried calling:…

MWA
- 51
- 2
- 11
0
votes
1 answer
How to solve ˜The getter 'documentID' was called on null.˜?
I have this function with scoped model in which I want to have a firebase increment to snapshot when the button is pressed, but It returns ˜The getter 'documentID' was called on null.˜, it changes the state of my icon but the number is not…

Ricardo Oscar Kanitz
- 529
- 8
- 19
0
votes
2 answers
Failed assertion: boolean expression must not be null with scoped model on flutter
I'm trying to create a function using scoped model which there will be a favorite_border icon and when it's pressed changes to a favorite icon. Besides that an increment counter will show the number of likes from the firebase data to the viewer. I'm…

Ricardo Oscar Kanitz
- 529
- 8
- 19
0
votes
1 answer
Unable to register model in locator services
I'm trying to register a model in my locator but I'm getting undefined when I put in the parameters in the model. service_locator.dart
import 'package:get_it/get_it.dart';
import '/services/repository_service.dart';
import…

Kagimura
- 397
- 1
- 7
- 20
0
votes
1 answer
Updated values get overridden on Widget redraw
I am playing around with a simple flutter countdown app. It consists of 2 pages, the clock and a settings page to set minutes and seconds to be counted down.
On the clock page (HomeWidget) the user clicks a button to navigate to the settings page.…

xmashallax
- 1,673
- 1
- 17
- 34
0
votes
1 answer
Flutter ScopedModel error " Only static members can be accessed in initializers"
I want to pass the ScopedModel to another page. Or in the initState call the ScopedModel so I can use the data.
final MainModel model;
IndexPage(this.model);
@override
State createState() {
return IndexPageState();
…

R. Martinez
- 119
- 2
- 10
0
votes
2 answers
Best practice to make API calls using scoped_model
I am working on a project using Flutter with scoped_model as state manager.
But there is one point that I'm not sure to understand.
I'm actually calling my API at every single build which looks weird to me.
What is the good practice to make API…

Q. Eude
- 841
- 11
- 24
0
votes
1 answer
How to retain data while using ScopedModel in Flutter?
I am using ScopedModel to fetch some data from a Firebase database.
I am fetching a list of events.
I fetch the events from the endpoint inside the Model;
I store the events into a List inside the model;
I use that list to build my…

Soon Santos
- 2,107
- 22
- 43
0
votes
0 answers
Complete scoped model async call in initstate before widget builds
I have a requirement which is to make an API call when the page is opened and use the result of the API call to populate a widget. I have to cater for cases like when the call is being made, show a loader, if an error occurs, show a widget that…

ibnhamza
- 861
- 1
- 15
- 29
0
votes
1 answer
Flutter scoped model not updating all descendants"
My app is intended to consume live sensors data from an API using flutter scoped_model. The data is a JSON array like these:
[
{
"id": 4,
"device_name": "fermentero2",
"active_beer": 4,
"active_beer_name": "Sourgobo",
…

deedos
- 1
- 3
0
votes
1 answer
How to track down why one member of a mixin is overwriting another in a scoped model
I am writing my first Flutter app, and I use the scoped model to manage global state. I have an issue that when I update one object of a class it also updates another class list containing the same type of objects. I am suspecting its my…

Phil Bousfield
- 51
- 4
0
votes
2 answers
Error: Could not find the correct ScopedModel when using ScopedModel.of(context)
As an outsider looking into flutter state management, I liked the idea of using scoped_model for state management as recommended in flutter.dev. I have a rewrite of the counter app running. I am able to access the model properties using…

Bishal
- 807
- 1
- 5
- 20
0
votes
1 answer
PlatformException throw unexpected
I call method in ScopedModel from outside ScopedModel (on button press). But PlatformException is not catch as I expect.
PlatformException is only catch in ScopedModel Method try/catch. It is not catch in button press try/catch.
Button…

FlutterFirebase
- 2,163
- 6
- 28
- 60
0
votes
0 answers
Recover ScopedModel without ScopedModelDescendant
In the docs from ScopedModel there is these instructions to retrieve a ScopedModel previosly created without ScopedModelDescendant. I don't realize if I could get rid from ScopedModelDescendant at all or I should declare it somewhere at last once?…

alexpfx
- 6,412
- 12
- 52
- 88