| Index: lib/src/source_visitor.dart
|
| diff --git a/lib/src/source_visitor.dart b/lib/src/source_visitor.dart
|
| index d40eee502b531fd087a5c49b59e036f75daa5a2f..339fae168c1103806719e14a9180086e4a0bb82c 100644
|
| --- a/lib/src/source_visitor.dart
|
| +++ b/lib/src/source_visitor.dart
|
| @@ -435,8 +435,25 @@ class SourceVisitor implements AstVisitor {
|
| }
|
|
|
| visitNodes(directives, between: oneOrTwoNewlines);
|
| - visitNodes(node.declarations,
|
| - before: twoNewlines, between: oneOrTwoNewlines);
|
| +
|
| + if (node.declarations.isNotEmpty) {
|
| + twoNewlines();
|
| +
|
| + for (var i = 0; i < node.declarations.length; i++) {
|
| + visit(node.declarations[i]);
|
| +
|
| + if (i < node.declarations.length - 1) {
|
| + // Require blank lines around classes.
|
| + if (node.declarations[i] is ClassDeclaration ||
|
| + node.declarations[i + 1] is ClassDeclaration) {
|
| + twoNewlines();
|
| + } else {
|
| + // Functions and variables can be more tightly packed.
|
| + oneOrTwoNewlines();
|
| + }
|
| + }
|
| + }
|
| + }
|
| }
|
|
|
| visitConditionalExpression(ConditionalExpression node) {
|
|
|