You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I have a class which is generated by freezed and contains a Default decorator on a IList property. Whenever the decorator and the type are on the same line the freezed generator breaks, if they are on different lines it works.
BuildRunner Failed Output
freezed on lib/model.dart:
An error `FormatterException` occurred while formatting the generated source for
`package:freezed_line_length_issue/model.dart`
which was output to
`lib/model.freezed.dart`.
This may indicate an issue in the generator, the input source code, or in the
source formatter.
Could not format because the source could not be parsed:
line 20, column 27 of .: Expected an identifier.
╷
20 │ IListConst([])) IList get serverTrails => throw _privateConstructorUsedError;
│ ^
╵
line 20, column 29 of .: A function body must be provided.
╷
20 │ IListConst([])) IList get serverTrails => throw _privateConstructorUsedError;
│ ^
╵
line 20, column 29 of .: Expected a class member.
╷
20 │ IListConst([])) IList get serverTrails => throw _privateConstructorUsedError;
│ ^
╵
line 38, column 27 of .: Expected an identifier.
╷
38 │ IListConst([])) IList serverTrails
│ ^
╵
line 38, column 29 of .: Expected to find '}'.
╷
38 │ IListConst([])) IList serverTrails
│ ^
╵
line 57, column 27 of .: Expected to find ','.
╷
57 │ as IListConst([])) IList,
│ ^
╵
line 57, column 33 of .: Expected to find ','.
╷
57 │ as IListConst([])) IList,
│ ^^^^^
╵
line 58, column 7 of .: Expected to find ';'.
╷
58 │ )as $Val);
│ ^^^^
╵
line 58, column 11 of .: Expected an identifier.
╷
58 │ )as $Val);
│ ^
╵
line 58, column 11 of .: Unexpected text ';'.
╷
58 │ )as $Val);
│ ^
╵
(17 more errors...)
[INFO] Running build completed, took 37ms
[INFO] Caching finalized dependency graph completed, took 38ms
[SEVERE] Failed after 79ms
To Reproduce
//model.dartimport'package:fast_immutable_collections/fast_immutable_collections.dart';
import'package:flutter/foundation.dart';
import'package:freezed_annotation/freezed_annotation.dart';
import'package:freezed_line_length_issue/trail.dart';
part'model.freezed.dart';
@freezedclassModelwith_$Model {
constModel._();
constfactoryModel({
@Default(IListConst<ServerTrail>([])) IList<ServerTrail> serverTrails, // if IList<ServerTrail> serverTrails is on new line it succeeds
}) =_Model;
}
Describe the bug
I have a class which is generated by freezed and contains a
Default
decorator on a IList property. Whenever the decorator and the type are on the same line the freezed generator breaks, if they are on different lines it works.BuildRunner Failed Output
freezed on lib/model.dart: An error `FormatterException` occurred while formatting the generated source for `package:freezed_line_length_issue/model.dart` which was output to `lib/model.freezed.dart`. This may indicate an issue in the generator, the input source code, or in the source formatter. Could not format because the source could not be parsed:
line 20, column 27 of .: Expected an identifier.
╷
20 │ IListConst([])) IList get serverTrails => throw _privateConstructorUsedError;
│ ^
╵
line 20, column 29 of .: A function body must be provided.
╷
20 │ IListConst([])) IList get serverTrails => throw _privateConstructorUsedError;
│ ^
╵
line 20, column 29 of .: Expected a class member.
╷
20 │ IListConst([])) IList get serverTrails => throw _privateConstructorUsedError;
│ ^
╵
line 38, column 27 of .: Expected an identifier.
╷
38 │ IListConst([])) IList serverTrails
│ ^
╵
line 38, column 29 of .: Expected to find '}'.
╷
38 │ IListConst([])) IList serverTrails
│ ^
╵
line 57, column 27 of .: Expected to find ','.
╷
57 │ as IListConst([])) IList,
│ ^
╵
line 57, column 33 of .: Expected to find ','.
╷
57 │ as IListConst([])) IList,
│ ^^^^^
╵
line 58, column 7 of .: Expected to find ';'.
╷
58 │ )as $Val);
│ ^^^^
╵
line 58, column 11 of .: Expected an identifier.
╷
58 │ )as $Val);
│ ^
╵
line 58, column 11 of .: Unexpected text ';'.
╷
58 │ )as $Val);
│ ^
╵
(17 more errors...)
[INFO] Running build completed, took 37ms
[INFO] Caching finalized dependency graph completed, took 38ms
[SEVERE] Failed after 79ms
To Reproduce
For completeness here is trail.dart
Expected behavior
Build runner would generate types w/out throwing errors regardless of whether the Default decorator is on its own line.
The text was updated successfully, but these errors were encountered: