| 40 columns | |
| >>> require at least one newline between directives |
| import 'a.dart';import 'b.dart';export 'c.dart'; |
| <<< |
| import 'a.dart'; |
| import 'b.dart'; |
| export 'c.dart'; |
| >>> allow an extra newline between directives |
| import 'a.dart'; |
| |
| import 'b.dart'; |
| export 'c.dart'; |
| <<< |
| import 'a.dart'; |
| |
| import 'b.dart'; |
| export 'c.dart'; |
| >>> collapse any other newlines |
| import 'a.dart'; |
| |
| |
| import 'b.dart'; |
| |
| |
| |
| |
| export 'c.dart'; |
| <<< |
| import 'a.dart'; |
| |
| import 'b.dart'; |
| |
| export 'c.dart'; |
| >>> deferred |
| import 'a.dart' |
| deferred |
| as |
| a; |
| <<< |
| import 'a.dart' deferred as a; |
| >>> part of |
| part of foo; |
| <<< |
| part of foo; |
| >>> long part of does not wrap |
| part of some_very_long_library_name_that_wraps; |
| <<< |
| part of some_very_long_library_name_that_wraps; |
| >>> no spaces between library identifiers |
| library a . b . c; |
| <<< |
| library a.b.c; |
| >>> no spaces after unnamed library |
| library ; |
| <<< |
| library; |
| >>> configuration |
| import'a'if(b . c . d)'e'; |
| <<< |
| import 'a' if (b.c.d) 'e'; |
| >>> configuration |
| export'a'if(b . c=='d' )'e'; |
| <<< |
| export 'a' if (b.c == 'd') 'e'; |
| >>> part-of with uri |
| part of'uri.dart' ; |
| <<< |
| part of 'uri.dart'; |
| >>> Both configuration and prefix. |
| import 'foo.dart' as foo if (config == 'value') 'other.dart'; |
| <<< |
| import 'foo.dart' as foo |
| if (config == 'value') 'other.dart'; |
| >>> Configuration before prefix. |
| ### This violates the language spec, but the parser currently allows it without |
| ### reporting an error and code in the wild relies on that. So the formatter |
| ### handles it gracefully. See: https://github.com/dart-lang/sdk/issues/56641 |
| import 'foo.dart' if (config == 'value') 'other.dart' as foo; |
| <<< |
| import 'foo.dart' |
| if (config == 'value') 'other.dart' |
| as foo; |