This repository was archived by the owner on Jul 16, 2023. It is now read-only.
This repository was archived by the owner on Jul 16, 2023. It is now read-only.
[New rule] Always put a newline between statements #557
Open
Description
This rule requires or disallows blank lines between the given 2 kinds of statements. Properly blank lines help developers to understand the code.
For example, the following configuration requires a blank line between a variable declaration and a return statement.
Bad:
class MyClass {
static const _defaultVariable1 = 0.0;
static const _defaultVariable2 = 0.0;
final String variable1;
final String variable2;
const MyClass({
required this.variable1,
required this.variable2,
});
void doSomething() {
// doSomething
}
}
int foo() {
var a = 1;
return a;
}
void foo() {
const a = 0;
const b = 0;
bar();
}
var greet = "hello,",
var name = "world";
log(greet, name);
var greet = "hello,",
var name = "world";
log(greet, name);
var greet = "hello,";
var name = "world";
log(greet, NAME);
var greet = "hello,";
var name = "world";
log(greet, name);
Good:
class MyClass {
static const _defaultVariable1 = 0.0;
static const _defaultVariable2 = 0.0;
final String variable1;
final String variable2;
const MyClass({
required this.variable1,
required this.variable2,
});
void doSomething() {
// doSomething
}
}
int foo() {
var a = 1;
return a;
}
void foo() {
const a = 0;
const b = 0;
bar();
}
var greet = "hello,",
var name = "world";
log(greet, name);
var greet = "hello,",
var name = "world";
log(greet, name);
var greet = "hello,";
var name = "world";
log(greet, NAME);
var greet = "hello,";
var name = "world";
log(greet, name);