[mob][photos] Assert that SelectionState inherited widget is in context or not
This commit is contained in:
@@ -18,10 +18,16 @@ class SelectionState extends InheritedWidget {
|
||||
required Widget child,
|
||||
}) : super(key: key, child: child);
|
||||
|
||||
static SelectionState? of(BuildContext context) {
|
||||
static SelectionState? maybeOf(BuildContext context) {
|
||||
return context.dependOnInheritedWidgetOfExactType<SelectionState>();
|
||||
}
|
||||
|
||||
static SelectionState of(BuildContext context) {
|
||||
final SelectionState? result = maybeOf(context);
|
||||
assert(result != null, 'No SelectionState found in context');
|
||||
return result!;
|
||||
}
|
||||
|
||||
@override
|
||||
bool updateShouldNotify(covariant InheritedWidget oldWidget) {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user