# prefer_border_from_border_side

| Severity | Quick Fix | Options |
|:--------:|:---------:|:-------:|
|   Info   |    ✅     |   ❌    |

## Details

**PREFER** using `Border.fromBorderSide` instead of `Border.all`.

Using `Border.fromBorderSide` is more efficient than `Border.all` because of possible const constructor usage.

```dart title="Bad"
DecoratedBox(
  decoration: BoxDecoration(
    border: Border.all(
      width: 1,
      style: BorderStyle.solid,
    ),
  ),
)
```

```dart title="Good"
const DecoratedBox(
  decoration: BoxDecoration(
    border: Border.fromBorderSide(
      BorderSide(
        width: 1,
        style: BorderStyle.solid,
      ),
    ),
  ),
)
```

## Usage

To enable the `prefer_border_from_border_side` rule, add `prefer_border_from_border_side` under `plugins > pyramid_lint > diagnostics` in your `analysis_options.yaml` file:

```yaml
plugins:
  pyramid_lint: <version>
    diagnostics:
      prefer_border_from_border_side: true
```
