prefer_asserts_in_initializer_lists

Group: style

Maturity: stable

Linter v0.1.33

Since info is static, may be stale

View all Lint Rules

Using the Linter

DO put asserts in initializer list for constructors with only asserts in their body.

GOOD:

class A {
  A(int a) : assert(a != null);
}

BAD:

class A {
  A(int a) {
    assert(a != null);
  }
}