The Scope package is generally very easy to use as it works as expected in almost all cases.
For the times when you are having problems, you can pass a
We recommend that you pass the
debugNameto all your Scope's and ScopeKeys. It will make debugging problems much easier if you get into the habit.
final key = ScopeKey<int>('debug key name');
Scope('debug scope name')
When running in the debugger the
debugNamewill be displayed.
You can also print out the
Scopeby calling their
Probably the most complex situation is when you have nested Scopes. Check the call stack for multiple Scope instances.
When you call
usewithin a Nested Scope it will search 'up' the call stack looking for the first Scope. If the key is found in that Scope then that value is returned. If the key isn't found we keep searching up the stack for additional Scopes.
hasScopeKeycan also help debugging problems when calling