BaiomyNavKit class
Primary navigation facade for flutter_nav_kit.
All methods are static. Before calling any named-route method, initialise
the kit once (usually in main.dart or your app widget):
void main() {
NavKit.init(routes: Routes());
runApp(const MyApp());
}
Named-route navigation
// Simple push
NavKit.push(context, Routes.home);
// With arguments
NavKit.push(context, Routes.detail, arguments: myItem);
// Animated variants
NavKit.pushWithSlideUp(context, Routes.detail);
NavKit.pushWithFade(context, Routes.settings);
// Replace / clear stack
NavKit.pushReplacement(context, Routes.home);
NavKit.pushAndRemoveAll(context, Routes.login);
Direct widget navigation (no route name needed)
NavKit.pushWidget(context, () => const MyPage());
NavKit.pushWidgetWithSlideUp(context, const MyPage());
Stack control
NavKit.pop(context);
NavKit.popUntil(context, Routes.home);
NavKit.canPop(context); // → bool
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
canPop(
BuildContext context) → bool -
Returns
trueif there is a route that can be popped. -
init(
{required NavRoutes routes}) → void - Call once at app startup with your NavRoutes subclass.
-
pop<
T> (BuildContext context, [T? result]) → void -
Pop the current route, optionally passing a
resultback. -
popUntil(
BuildContext context, String routeName) → void -
Pop routes until
routeNameis at the top of the stack. -
push<
T> (BuildContext context, String routeName, {Object? arguments}) → Future< T?> - Push with the default platform-aware transition (fade / cupertino).
-
pushAndRemoveAll<
T> (BuildContext context, String routeName, {Object? arguments}) → Future< T?> - Push and remove all with the default platform-aware transition.
-
pushAndRemoveAllWithFade<
T> (BuildContext context, String routeName, {Object? arguments, Duration? transitionDuration, Duration? reverseTransitionDuration}) → Future< T?> - Push and remove all with fade.
-
pushAndRemoveAllWithSlideUp<
T> (BuildContext context, String routeName, {Object? arguments, Duration? transitionDuration, Duration? reverseTransitionDuration}) → Future< T?> - Push and remove all with bottom-to-up slide + fade.
-
pushIfNotCurrent<
T> (BuildContext context, String routeName, {Object? arguments, NavTransitionType? transitionType, Duration? transitionDuration, Duration? reverseTransitionDuration}) → Future< T?> -
Push only if
routeNameis not already the current route. -
pushNamed<
T> (BuildContext context, String routeName, {Object? arguments, NavTransitionType? transitionType, Duration? transitionDuration, Duration? reverseTransitionDuration}) → Future< T?> - Push a named route with an optional animated transition.
-
pushNamedAndRemoveAll<
T> (BuildContext context, String routeName, {Object? arguments, NavTransitionType? transitionType, Duration? transitionDuration, Duration? reverseTransitionDuration}) → Future< T?> - Push a named route and clear the entire back-stack.
-
pushReplacement<
T, TO> (BuildContext context, String routeName, {Object? arguments, TO? result}) → Future< T?> - Push replacement with the default platform-aware transition.
-
pushReplacementNamed<
T, TO> (BuildContext context, String routeName, {Object? arguments, TO? result, NavTransitionType? transitionType, Duration? transitionDuration, Duration? reverseTransitionDuration}) → Future< T?> - Push a named route, replacing the current one.
-
pushReplacementWithFade<
T, TO> (BuildContext context, String routeName, {Object? arguments, TO? result, Duration? transitionDuration, Duration? reverseTransitionDuration}) → Future< T?> - Push replacement with fade.
-
pushReplacementWithSlideUp<
T, TO> (BuildContext context, String routeName, {Object? arguments, TO? result, Duration? transitionDuration, Duration? reverseTransitionDuration}) → Future< T?> - Push replacement with bottom-to-up slide + fade.
-
pushWidget<
T> (BuildContext context, Widget pageBuilder(), {NavTransitionType transitionType = NavTransitionType.fade, Duration? transitionDuration, Duration? reverseTransitionDuration, bool maintainState = true, bool fullscreenDialog = false}) → Future< T?> - Push a widget directly using a lazy builder (avoids building the widget before the transition starts).
-
pushWidgetWithFade<
T> (BuildContext context, Widget page, {Duration? transitionDuration, Duration? reverseTransitionDuration}) → Future< T?> - Push a widget with fade.
-
pushWidgetWithSlideUp<
T> (BuildContext context, Widget page, {Duration? transitionDuration, Duration? reverseTransitionDuration}) → Future< T?> - Push a widget with bottom-to-up slide + fade.
-
pushWidgetWithTransition<
T> (BuildContext context, Widget page, {NavTransitionType transitionType = NavTransitionType.fade, Duration? transitionDuration, Duration? reverseTransitionDuration}) → Future< T?> - Push a widget directly with a custom transition.
-
pushWithFade<
T> (BuildContext context, String routeName, {Object? arguments, Duration? transitionDuration, Duration? reverseTransitionDuration}) → Future< T?> - Push with a simple fade animation.
-
pushWithSlide<
T> (BuildContext context, String routeName, {Object? arguments, Duration? transitionDuration, Duration? reverseTransitionDuration}) → Future< T?> - Push with a slide-only animation (no fade).
-
pushWithSlideAndFade<
T> (BuildContext context, String routeName, {Object? arguments, Duration transitionDuration = const Duration(milliseconds: 380), Duration reverseTransitionDuration = const Duration(milliseconds: 470)}) → Future< T?> - Push with a slide + fade animation.
-
pushWithSlideUp<
T> (BuildContext context, String routeName, {Object? arguments, Duration transitionDuration = const Duration(milliseconds: 380), Duration reverseTransitionDuration = const Duration(milliseconds: 470)}) → Future< T?> - Push with a bottom-to-up slide + fade animation.
-
replaceStack(
BuildContext context, List< String> routes, {NavTransitionType? transitionType, Duration? transitionDuration, Duration? reverseTransitionDuration}) → Future<void> - Replace the entire navigation stack with an ordered list of routes.