go_router_linter 0.1.1+1 go_router_linter: ^0.1.1+1 copied to clipboard
A custom lint rule that checks for the use of GoRouterHelper.
Go Router Linter #
go_router_linter
is a custom linting package designed to enhance code quality and consistency when using the go_router
package in Dart and Flutter applications. It encourages best practices by identifying and suggesting improvements for common patterns.
Features #
- Lint Rule: Use
context.go()
Instead ofGoRouter.of(context).go()
- Detects instances where
GoRouter.of(context).go()
is used and suggests replacing it with the more concisecontext.go()
.
- Detects instances where
Installation #
To integrate go_router_linter
into your project, follow these steps:
-
Add Dependency
In your
pubspec.yaml
file, includego_router_linter
underdev_dependencies
:dev_dependencies: go_router_linter: ^0.1.0
-
Update
analysis_options.yaml
Enable the custom lint rule by adding the following to your
analysis_options.yaml
file:analyzer: plugins: - custom_lint custom_lint: rules: - use_context_directly_for_go_router
Usage #
After setting up, the linter will automatically analyze your code and provide warnings or suggestions based on the defined rules. For example, if GoRouter.of(context).go()
is detected, the linter will recommend using context.go()
instead.
Contributing #
Contributions are welcome! If you have ideas for new lint rules or improvements, please open an issue or submit a pull request on our GitHub repository.
License #
This project is licensed under the MIT License. See the LICENSE file for details.
Acknowledgements #
Special thanks to the Dart and Flutter communities for their continuous support and contributions.