prefer-bloc-event-suffix
- Group
- Style
- Path
lint/style/prefer-bloc-event-suffix- Default
- Off, opt in
- Origin
- Falcon
- Domain
- bloc
- Rule
- 318 of 512
bloc
Enforce the package-confirmed Bloc convention.
Invalid
example.dartdart
import 'package:bloc/bloc.dart';
class Action {}
class Variant0 extends Action {}
class Variant1 extends Action {}
class Variant2 extends Action {}
class Variant3 extends Action {}
class Example extends Bloc<Action, int> { Example() : super(0); }End Bloc event class names with `Event`.
1
import 'package:bloc/bloc.dart';2
class Action {}End Bloc event class names with `Event`.
2
class Action {}3
class Variant0 extends Action {}End Bloc event class names with `Event`.
3
class Variant0 extends Action {}4
class Variant1 extends Action {}End Bloc event class names with `Event`.
4
class Variant1 extends Action {}5
class Variant2 extends Action {}End Bloc event class names with `Event`.
5
class Variant2 extends Action {}6
class Variant3 extends Action {}Valid
example.dartdart
import 'package:bloc/bloc.dart';
class ActionEvent {}
class Variant0Event extends ActionEvent {}
class Variant1Event extends ActionEvent {}
class Variant2Event extends ActionEvent {}
class Variant3Event extends ActionEvent {}
class Example extends Bloc<ActionEvent, int> { Example() : super(0); }
class Unrelated {}Configure prefer-bloc-event-suffix
Set its severity in falcon.json. See the configuration guide.
falcon.jsonjson
{
"linter": {
"rules": {
"style": {
"prefer-bloc-event-suffix": "error"
}
}
}
}Or silence one occurrence with a suppression comment; the reason is required.
example.dartdart
// falcon-ignore lint/style/prefer-bloc-event-suffix: <reason>More style rules
- prefer-bloc-extensionsbloc
Prefer context.read/watch over
package:flutter_bloc's provider lookups. - prefer-bloc-state-suffixbloc
Enforce the package-confirmed Bloc convention.
- prefer-center-over-alignflutter
Prefers
Centerover anAlignwhose alignment is known to be centered. - prefer-collection-literals
prefer_collection_literalsrecommendedFlags no-argument collection constructor calls that a literal would express.
- prefer-commenting-analyzer-ignores
Require explanations for analyzer
ignore:andignore_for_file:comments. - prefer-const-constructors
prefer_const_constructorsPrefers
constwhen invoking aconstconstructor with constant arguments. - prefer-const-constructors-in-immutables
prefer_const_constructors_in_immutablesflutterPrefers
constconstructors in immutable classes and extension types. - prefer-const-declarations
prefer_const_declarationsrecommendedFlags
finaldeclarations whose initializers are all constant expressions.