Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/kaboc/grab-lints

Lint rules to help avoid common misuse of Grab.
https://github.com/kaboc/grab-lints

flutter flutter-lint lint lint-rules

Last synced: 21 days ago
JSON representation

Lint rules to help avoid common misuse of Grab.

Awesome Lists containing this project

README

        

[![Pub Version](https://img.shields.io/pub/v/grab_lints)](https://pub.dev/packages/grab_lints)

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](https://pub.dev/packages/custom_lint).

### pubspec.yaml

Put the latest version in place of `x.x.x` below.

```yaml
dev_dependencies:
custom_lint:
grab_lints: x.x.x
```

### analysis_options.yaml

```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:


  • Not the one from the build method

  • Passed via a variable

The 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. |

[Grab]: https://pub.dev/packages/grab