Output Error:
The following NoSuchMethodError was thrown building ScopedModelDescendant<MainModel>(dirty, dependencies: [_InheritedModel<MainModel>]):
The getter 'sampleVariable' was called on null.
Receiver: null
Tried calling: sampleVariable
Scenario: I have multiple classes that extends Model chained to one main class (i.e. MainModel). Now, i've updated a variable within one of the classes that I have extended from the Model of "scoped model". When I tried to access that variable after navigated to another component it raises a "NoSuchMethodError" => The getter "variable" was called on null. Could that be a bug?
The one that populates the variable:
...
sampleVariable = 'NewData';
notifyListeners();
Navigator.pushNamed(context, 'newPage');
newPage component tries to get the variable "sampleVariable":
...
ScopedModelDescendant<MainModel>(
builder: (BuildContext context, Widget child, MainModel model) {
print(model.sampleVariable);
...
}),
...
And the wierd part is it prints the variable "sampleVariable" value when "Restart" button triggered from the vscode flutter actions.