Skip to contentSlop Block

require-blank-line-after-guard

Warning

Leave a blank line after a one-line guard such as if (index < 0) return;.

void run(int index) {  if (index < 0) return;Leave a blank line after this guard  save(index);}
void run(Response response) {  if (response.parsedData == null) throw Exception("Failed to sign in");Leave a blank line after this guard  final user = response.parsedData!.signIn;}
// ast-grep-ignore: require-blank-line-after-guard-dart

How to fix

A one-line guard such as if (index < 0) return; ends a group of statements.

The check reads the enclosing block's text because the syntax tree omits blank lines. If the block has several violations of this rule, the report can land on a neighboring node.