Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lint rule for missing yield statement #24

Open
r-shahpasand opened this issue Dec 10, 2020 · 2 comments
Open

Lint rule for missing yield statement #24

r-shahpasand opened this issue Dec 10, 2020 · 2 comments

Comments

@r-shahpasand
Copy link

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?

@passsy
Copy link
Owner

passsy commented Dec 10, 2020

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.

@r-shahpasand
Copy link
Author

Then can't I add a custom rule that warn me about this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants