Skip to content

fix: avoid_public_bloc_methods for getters #4694

@aggeloskoutanis

Description

@aggeloskoutanis

Description
Hello everyone. First of all, thanks for creating the bloc linter. I am delighted with it. I just wanted to bring something up for discussion that I think is mistakenly flagged by the lint rule avoid_public_bloc_methods.
In my bloc, I have a public getter which I use as a utility getter in order to access a bool variable. This bool variable is declared and initialized inside my bloc, and it's static.
Now, this getter is flagged by the avoid_public_bloc_methods rule, which I understand why, but I think it shouldn't be. My understanding is that this rule exists so we won't use a public method to alter the state inside the bloc, and instead use the events of the bloc to do this.

The getter is not used to change the state, so I find it a bit irrelevant to flag this with avoid_public_bloc_methods.

Steps To Reproduce

  1. Create a getter inside a bloc (example: bool get hello => false;)

Expected Behavior
Do not mark methods/getters that don't change the state with the rule avoid_public_bloc_methods.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingpkg:bloc_lintThis issue is related to the bloc_lint packagewaiting for responseWaiting for follow up

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions