prefer-match-file-name
- Group
- Style
- Path
lint/style/prefer-match-file-name- Default
- Off, opt in
- Origin
- Falcon
- Rule
- 384 of 512
Match a file's sole class or enum name to its snake-case basename.
Other declarations may coexist with the type. Files with multiple classes or enums, generated inner-dot suffixes, and part-of files are left alone. Naming convention violations themselves belong to the existing naming rules.
Invalid
class Account {
final int id;
Account(this.id);
}class Account {Valid
class Good {
void run() {}
}Configure prefer-match-file-name
Set its severity in falcon.json. See the configuration guide.
{
"linter": {
"rules": {
"style": {
"prefer-match-file-name": "error"
}
}
}
}Or silence one occurrence with a suppression comment; the reason is required.
// falcon-ignore lint/style/prefer-match-file-name: <reason>More style rules
- prefer-mixin
prefer_mixinrecommendedFlags
withclauses that mix in a plain class instead of a mixin. - prefer-multi-bloc-providerbloc
Flatten directly nested
package:flutter_blocBlocProviderswithMultiBlocProvider. - prefer-multi-providerprovider
Prefer a flat
MultiProviderto directly nested provider widgets. - prefer-named-boolean-parameters
Flags explicit positional
boolparameters in private declarations and unconstrained closures. - prefer-named-parameters
Prefer named parameters when a declaration exceeds
max-number(default 1). - prefer-null-aware-method-calls
prefer_null_aware_method_callsrecommendedPrefers
f?.call()to calling a null-checked function after a!= nulltest. - prefer-padding-over-containerflutter
Prefers
Paddingover aContainerused only forpadding. - prefer-provider-extensionsprovider
Prefer context.read/watch when provider extensions are in scope.