File tree Expand file tree Collapse file tree 3 files changed +34
-3
lines changed Expand file tree Collapse file tree 3 files changed +34
-3
lines changed Original file line number Diff line number Diff line change 33* Upgrade ` dart_style ` and ` source_gen ` to remove ` package:macros ` dependency.
44* Require Dart ` ^3.6.0 ` due to the upgrades.
55* Support ` Expression.newInstanceNamed ` with empty name
6+ * Fixed bug: Fields declared with ` static ` and ` external ` now produce code with correct order
67
78## 4.10.1
89
Original file line number Diff line number Diff line change @@ -437,15 +437,15 @@ class DartEmitter extends Object
437437 for (var a in spec.annotations) {
438438 visitAnnotation (a, output);
439439 }
440+ if (spec.external ) {
441+ output.write ('external ' );
442+ }
440443 if (spec.static ) {
441444 output.write ('static ' );
442445 }
443446 if (spec.late && _useNullSafetySyntax) {
444447 output.write ('late ' );
445448 }
446- if (spec.external ) {
447- output.write ('external ' );
448- }
449449 switch (spec.modifier) {
450450 case FieldModifier .var$:
451451 if (spec.type == null ) {
Original file line number Diff line number Diff line change @@ -110,4 +110,34 @@ void main() {
110110 ''' ),
111111 );
112112 });
113+
114+ test ('should create a late static field' , () {
115+ expect (
116+ Field ((b) => b
117+ ..name = 'value'
118+ ..static = true
119+ ..late = true
120+ ..type = refer ('String' )
121+ ..annotations.addAll ([refer ('JS' ).call ([])])),
122+ equalsDart (r'''
123+ @JS()
124+ static late String value;
125+ ''' , DartEmitter (useNullSafetySyntax: true )),
126+ );
127+ });
128+
129+ test ('should create an external static field' , () {
130+ expect (
131+ Field ((b) => b
132+ ..name = 'value'
133+ ..external = true
134+ ..static = true
135+ ..type = refer ('double' )
136+ ..annotations.addAll ([refer ('JS' ).call ([])])),
137+ equalsDart (r'''
138+ @JS()
139+ external static double value;
140+ ''' ),
141+ );
142+ });
113143}
You can’t perform that action at this time.
0 commit comments