unrouter 0.2.0
unrouter: ^0.2.0 copied to clipboard
A Flutter router that gives you routing flexibility: define routes centrally, scope them to widgets, or mix both - with browser-style history navigation.
0.2.0 #
Breaking Changes #
- Navigation API refactored: History navigation methods (
back(),forward(),go()) are now accessed throughnavigateproperty- Before:
router.back() - After:
router.navigate.back()
- Before:
- Internal reorganization: Removed
router_delegate.dartfile. TheNavigateinterface and router delegate logic have been consolidated intorouter.dart
Features #
- Link widget: Added declarative navigation with the new
Linkwidget (#5)- Simple usage:
Link(to: Uri.parse('/about'), child: Text('About')) - Advanced usage:
Link.builderfor custom gesture handling - Supports
replaceandstateparameters - Automatic mouse cursor (click) and accessibility semantics (link role)
- Example: Build navigation links without imperative callbacks
- Simple usage:
- BuildContext extensions: Added convenient extensions for navigation (#6)
- Use
context.navigateto access navigation methods from any widget - Use
context.routerto access the router instance - Example:
context.navigate(.parse('/about'))
- Use
- Better error messages:
Navigate.of()now throws helpfulFlutterErrorwith clear messages when:- Called outside a Router scope
- Router delegate doesn't implement
Navigate
Improvements #
- Changed
matchRoutesparameter type fromList<Inlet>toIterable<Inlet>for better flexibility - Updated examples to demonstrate new BuildContext extension usage
- Added comprehensive tests for context navigation features
Migration Guide #
Update your navigation code to use the new API:
// Before
router.back()
router.forward()
router.go(-1)
// After
router.navigate.back()
router.navigate.forward()
router.navigate.go(-1)
// Or use the new BuildContext extension
context.navigate.back()
0.1.1 #
- Update package description and add pub topics
- Remove routingkit dependency and format product card
- Format Dart code with dart format