of static method

SideBarState of(
  1. BuildContext context
)

Get first SideBar ancestor state

Implementation

static SideBarState of(BuildContext context) {
  SideBarState? state = context.findAncestorStateOfType<SideBarState>();

  if (state == null) {
    throw FlutterError(
        "SideBar operation requested with a context that does not include a SideBar as descendand.");
  }

  return state;
}