Lint rules to warn you about common misuse of Grab and fix it quickly.
This package is incompatible with grab 1.0.0-dev.1 and above.
grab_lints is no longer necessary to avoid misuse related to the limitations
that existed in older versions of grab.
Setup
This plugin uses custom_lint.
pubspec.yaml
Put the latest version in place of x.x.x
below.
dev_dependencies:
custom_lint:
grab_lints: x.x.x
analysis_options.yaml
analyzer:
plugins:
- custom_lint
Available lints
Errors
Rule | Fix | Details |
---|---|---|
missing_grab_mixin | ✅ | A necessary Grab mixin is missing in the with clause. |
wrong_grab_mixin | ✅ | The widget class has a mismatching Grab mixin in the with clause. |
Warnings
Rule | Fix | Details |
---|---|---|
unnecessary_grab_mixin | ✅ | An unnecessary Grab mixin is in the with clause. |
maybe_wrong_build_context_for_grab | (✅) | The BuildContext passed to the grab method has either of the following issues:
BuildContext parameter itself of the build method should be directly used to avoid misuse or confusion.Quick fix is available only when an automatic fix is possible. |
avoid_grab_outside_build | A grab method has been used outside the build method of a widget.It is discouraged although using the method outside the build method is possible as long as the correct BuildContext is used. Such usage easily leads to misuse or confusion. |