dart-lint
dart-lint copied to clipboard
Lint rule for missing yield statement
In my bloc I have following code:
@override
Stream<VerificationState> mapEventToState(VerificationEvent event) async* {
yield* event.when(
loginRetry: (phoneNumber) => _loginRetry( phoneNumber ),
verify: (phoneNumber, code) => _verify(phoneNumber, code),
);
}
If I forget to add yield*, lint does not warn me. How can I be warned for such a mistake?
static analysis can't help here. A async* function without yield/yield* is fine, returning a Stream without elements. In many cases that's exactly what you want.
Then can't I add a custom rule that warn me about this?