navigate method

void navigate(
  1. NavNodeId id
)

Make id the active destination. Auto-opens its ancestor modules and closes the mobile drawer (so a drawer tap navigates and dismisses).

Implementation

void navigate(NavNodeId id) {
  final n = node(id);
  if (n == null || !n.enabled) return;
  var changed = false;
  if (_active != id) {
    _active = id;
    changed = true;
  }
  if (_autoExpandActive) {
    for (final a in NavOps.ancestorsOf<T>(_sections, id)) {
      changed |= _expanded.add(a);
    }
  }
  if (_drawerOpen) {
    _drawerOpen = false;
    changed = true;
  }
  if (changed) notifyListeners();
}