flutter_navkit 2.0.2
flutter_navkit: ^2.0.2 copied to clipboard
A powerful navigation toolkit for Flutter with type-safe routing, automatic route generation, and comprehensive navigation observability.
Changelog #
2.0.2 Initial Release (Re-published) #
🎉 Initial Release #
⚠️ Note: This release was re-published because the wrong README file was uploaded in the previous attempt.
No code changes were made — only documentation was corrected.
✨ Features
- NavkitApp Widget – Drop-in replacement for
MaterialAppwith built-in navigation observer. - Automatic Route Generation – Use
@NavkitRoute()annotation to auto-generate type-safe route constants. - NavkitObserver – Full navigation tracking with:
- Route stack visualization in debug mode
- Clean console logging with emojis (➡️ Push, ⬅️ Pop, 🔄 Remove, 🔀 Replace)
hasRoute()to check existing routes in the stack- Optional stack printing via
observeWithStack
🚀 Navigation Extensions
Normal Navigation (Widget-Based):
context.push()context.pushReplacementTo()context.pushAndRemoveAll()context.pop()context.popToFirst()context.maybePop()context.canPop
Named Navigation (Route-Based):
context.pushRoute()context.pushReplacementRoute()context.popAndPushRoute()context.pushAndRemoveAllRoute()context.popTo()context.tryPushRoute()context.tryPopTo()
🔧 Code Generation
@NavkitRouteannotation for marking screens- Optional
routeNameoverride - Auto-generated
NavkitRoutesclass - Full build_runner integration
📦 Package Structure
NavkitApp– main entry widgetNavkitObserver– advanced route observer@NavkitRoute– annotation for route generation- Navigation extensions on
BuildContext
🎯 Developer Experience
- Type-safe navigation with autocomplete
- Zero-boilerplate route management
- Intuitive API following Flutter's patterns
- Detailed debug logging
- Fully compatible with Flutter's Navigator 1.0
📚 Documentation
- Updated README (fixed in this release)
- Full usage examples
- In-depth API explanations
- Example project included
Migration Guides #
Migrating to 1.0.7 from 1.0.6 #
If you're using generated routes, update your code:
Before (1.0.6):
NavKitGeneratedRoute(
name: '/profile',
page: const ProfileScreen(),
)
After (1.0.7):
NavKitGeneratedRoute(
name: '/profile',
builder: (settings) => const ProfileScreen(),
)
With Arguments:
NavKitGeneratedRoute(
name: '/details',
builder: (settings) {
final args = settings.arguments as Map<String, dynamic>?;
final id = args?['id'] as int? ?? 0;
return DetailsScreen(id: id);
},
)
Note: Annotation-based routing (@NavkitRoute) continues to work without any changes.