Open ahmadjz opened 1 year ago
@ahmadjz
The same phenomenon occurred to me as well.
Although it is not a fundamental solution, you can exclude it from the flutter analyze
inspection by adding the following to analysis_options.yaml
.
How about this?
analyzer:
exclude:
- "**/*.g.dart"
- "**/*.freezed.dart"
errors:
invalid_annotation_target: ignore
I know it's been a while but had this been fixed in later versions?
Describe the Bug
In the generated code by
Retrofit.dart
, there is a warning regarding a final variable that could be const. Specifically, the warning is "Use 'const' for final variables initialized to a constant value". The line of code generating this warning is:final Map<String, dynamic>? _data = null;
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Generated code should be free of warnings to follow Dart's best practices. if we have no data/fields provided then
_data
variable should be const not finalFull Code
generated code: