initialize_ in_ field_ declaration
Learn about the initialize_in_field_declaration linter rule.
Initialize the field in the field's initializer.
Details
#Initialize fields where they're declared when possible.
Enable
#
To enable the initialize_in_field_declaration rule, add initialize_in_field_declaration
under
linter > rules in your analysis_options.yaml
file:
linter:
rules:
- initialize_in_field_declaration
If you're instead using the YAML map syntax to configure linter rules,
add initialize_in_field_declaration: true under linter > rules:
linter:
rules:
initialize_in_field_declaration: true
Unless stated otherwise, the documentation on this site reflects Dart 3.12.2. Report an issue.