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
Adjust analysis_options.yaml and enable non-default rules, for example, 'omit_local_variable_types'
Proceed code generation
Execute flutter analyze --fatal-warnings on the code sample
Expected results:
No warnings or errors are shown for generated .chopper.dart files
Actual results:
Linter warnings are shown for .chopper.dart files:
info • Unnecessary type annotation on a local variable • sources/core/patient_core/lib/src/api/services/dummy_service.chopper.dart:21:5 • omit_local_variable_types
info • Unnecessary type annotation on a local variable • sources/core/platform_core/lib/src/api/services/dummy_service.chopper.dart:21:5 • omit_local_variable_types
info • Unnecessary type annotation on a local variable • sources/core/platform_core/lib/src/api/services/dummy_service.chopper.dart:22:5 • omit_local_variable_types
Solution
It would help if you disabled the linter for the generated files entirely instead of ignoring specific rules.
So please replace the comment in generated files // ignore_for_file: always_put_control_body_on_new_line, always_specify_types, prefer_const_declarations, unnecessary_string_interpolations, unnecessary_brace_in_string_interps with // ignore_for_file: type=lint.
This approach is used by other projects like built_value.
The text was updated successfully, but these errors were encountered:
Steps to Reproduce
analysis_options.yaml
and enable non-default rules, for example, 'omit_local_variable_types'flutter analyze --fatal-warnings
on the code sampleExpected results:
No warnings or errors are shown for generated
.chopper.dart
filesActual results:
Linter warnings are shown for
.chopper.dart
files:info • Unnecessary type annotation on a local variable • sources/core/patient_core/lib/src/api/services/dummy_service.chopper.dart:21:5 • omit_local_variable_types
Code sample
dummy_service.dart
analysis_options.yaml
Logs
Solution
It would help if you disabled the linter for the generated files entirely instead of ignoring specific rules.
So please replace the comment in generated files
// ignore_for_file: always_put_control_body_on_new_line, always_specify_types, prefer_const_declarations, unnecessary_string_interpolations, unnecessary_brace_in_string_interps
with// ignore_for_file: type=lint
.This approach is used by other projects like built_value.
The text was updated successfully, but these errors were encountered: