of static method

Implementation

static BottomNavigationController of(BuildContext context) {
  final bodyState = context.findAncestorStateOfType<BottomNavigationBodyState>();
  if (bodyState != null) {
    return bodyState.widget.controller;
  }
  final barState = context.findAncestorStateOfType<BottomNavigationBarBuilderState>();
  if (barState != null) {
    return barState.widget.controller;
  }
  throw StateError(
    'There must be at least one BottomNavigationBody or BottomNavigationBarBuilder in the acenstors of this widget.',
  );
}