of static method

DbViewerNavigatorState of(
  1. BuildContext context, {
  2. dynamic rootNavigator = false,
})

Implementation

static DbViewerNavigatorState of(
  BuildContext context, {
  rootNavigator = false,
}) {
  final DbViewerNavigatorState? navigator = rootNavigator
      ? context.findRootAncestorStateOfType<DbViewerNavigatorState>()
      : context.findAncestorStateOfType<DbViewerNavigatorState>();

  assert(() {
    if (navigator == null) {
      throw FlutterError(
          'DbViewerNavigator operation requested with a context that does not include a DbViewerNavigator.\n'
          'The context used to push or pop routes from the DbViewerNavigator must be that of a '
          'widget that is a descendant of a DbViewerNavigator widget.');
    }
    return true;
  }());

  return navigator!;
}