of static method
- BuildContext context
Retrieves the nearest ZdsSplitNavigatorState ancestor from the given BuildContext.
This method searches up the widget tree starting from the given BuildContext, and returns the nearest ancestor of type ZdsSplitNavigatorState.
If no ZdsSplitNavigatorState ancestor is found, a FlutterError is thrown.
Usage:
final ZdsSplitNavigatorState = ZdsSplitNavigatorState.of(context);
context
: The BuildContext to start the search from.
Returns: The nearest ZdsSplitNavigatorState ancestor found.
Implementation
static ZdsSplitNavigatorState of(BuildContext context) {
final ZdsSplitNavigatorState? state = context.findAncestorStateOfType<ZdsSplitNavigatorState>();
if (state == null) throw FlutterError('Ancestor state of type ZdsSplitNavigatorState not found');
return state;
}