/// Provides the active bottom-nav tab index for [MainShell]. library; import 'package:flutter/material.dart'; class ShellTabScope extends InheritedWidget { const ShellTabScope({ super.key, required this.index, required super.child, }); final int index; static int of(BuildContext context) { final scope = context.dependOnInheritedWidgetOfExactType(); assert(scope != null, 'ShellTabScope not found'); return scope!.index; } static int? maybeOf(BuildContext context) { return context.dependOnInheritedWidgetOfExactType()?.index; } @override bool updateShouldNotify(ShellTabScope oldWidget) => index != oldWidget.index; }