mirror of
https://github.com/flutter/samples.git
synced 2026-03-31 08:44:26 +00:00
Samples maintenance (#435)
This commit is contained in:
@@ -24,16 +24,17 @@ class AppModel<T> extends StatefulWidget {
|
||||
final T initialState;
|
||||
final Widget child;
|
||||
|
||||
@override
|
||||
_AppModelState<T> createState() => _AppModelState<T>();
|
||||
|
||||
static T of<T>(BuildContext context) {
|
||||
final _AppModelScope<T> scope =
|
||||
final scope =
|
||||
context.dependOnInheritedWidgetOfExactType<_AppModelScope<T>>();
|
||||
return scope.appModelState.currentState;
|
||||
}
|
||||
|
||||
static void update<T>(BuildContext context, T newState) {
|
||||
final _AppModelScope<T> scope =
|
||||
final scope =
|
||||
context.dependOnInheritedWidgetOfExactType<_AppModelScope<T>>();
|
||||
scope.appModelState.updateState(newState);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user