prefer-assert-initializers-first
Suggests placing assert initializers at the beginning of the initializer list.
Example
❌ Bad:
class SomeClass {
final String value;
final int another;
SomeClass(int val, int some)
: value = '123',
// LINT: Prefer placing assert initializers at the beginning of the initializer list.
assert(val > 0),
another = 123,
// LINT: Prefer placing assert initializers at the beginning of the initializer list.
assert(some > 2);
}
✅ Good:
class SomeClass {
final String value;
final int another;
SomeClass(int val, int some)
: assert(val > 0),
assert(some > 2),
value = '123',
another = 123;
}