flutter_navkit 2.0.2 copy "flutter_navkit: ^2.0.2" to clipboard
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 MaterialApp with 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

  • @NavkitRoute annotation for marking screens
  • Optional routeName override
  • Auto-generated NavkitRoutes class
  • Full build_runner integration

📦 Package Structure

  • NavkitApp – main entry widget
  • NavkitObserver – 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.

4
likes
150
points
267
downloads

Publisher

unverified uploader

Weekly Downloads

A powerful navigation toolkit for Flutter with type-safe routing, automatic route generation, and comprehensive navigation observability.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

analyzer, build, flutter, source_gen

More

Packages that depend on flutter_navkit