This repository was archived by the owner on Apr 8, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +20
-3
lines changed Expand file tree Collapse file tree 3 files changed +20
-3
lines changed Original file line number Diff line number Diff line change 1
1
## 3.5.0
2
2
3
3
* Add support for defining enums.
4
+ * Fix keyword ordering for ` const factory ` constructors.
4
5
5
6
## 3.4.1
6
7
Original file line number Diff line number Diff line change @@ -157,12 +157,12 @@ class DartEmitter extends Object
157
157
if (spec.external ) {
158
158
output.write ('external ' );
159
159
}
160
- if (spec.factory ) {
161
- output.write ('factory ' );
162
- }
163
160
if (spec.constant) {
164
161
output.write ('const ' );
165
162
}
163
+ if (spec.factory ) {
164
+ output.write ('factory ' );
165
+ }
166
166
output.write (clazz);
167
167
if (spec.name != null ) {
168
168
output..write ('.' )..write (spec.name);
Original file line number Diff line number Diff line change @@ -248,6 +248,22 @@ void main() {
248
248
);
249
249
});
250
250
251
+ test ('should create a class with a const factory constructor' , () {
252
+ expect (
253
+ Class ((b) => b
254
+ ..name = 'Foo'
255
+ ..constructors.add (Constructor ((b) => b
256
+ ..factory = true
257
+ ..constant = true
258
+ ..redirect = refer ('_Foo' )))),
259
+ equalsDart (r'''
260
+ class Foo {
261
+ const factory Foo() = _Foo;
262
+ }
263
+ ''' ),
264
+ );
265
+ });
266
+
251
267
test ('should create a class with a factory lambda constructor' , () {
252
268
expect (
253
269
Class ((b) => b
You can’t perform that action at this time.
0 commit comments