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

feat: keepAliveRiverpod shorthand #3277

Closed
wants to merge 2 commits into from
Closed

Conversation

Zfinix
Copy link

@Zfinix Zfinix commented Jan 15, 2024

When using Riverpod for state management in Flutter, it is essential to ensure that your code is efficient and easy to read. One way to improve the readability and brevity of your code is to use a shorthand annotation, @keepAliveRiverpod, instead of @Riverpod(keepAlive: true).

The @keepAliveRiverpod annotation is a concise way to indicate that a provider should remain active even when not being listened to. It is a simple and clear declaration that is easy to understand and write:

@keepAliveRiverpod
final myProvider = Provider((ref) => MyService());

Using @keepAliveRiverpod makes the intention of your code immediately clear to anyone who is reading it. It is more intuitive than the @Riverpod parameter and can be easily identified. So, by using @keepAliveRiverpod, you can improve the readability and brevity of your code.

@rrousselGit
Copy link
Owner

Hello!

I appreciate the desire to contribute, but this is skipping some necessary steps. New features should be first discussed in issues before making PRs.
Could you open an issue to discuss this? In the meantime I'm going to close this.

@Zfinix
Copy link
Author

Zfinix commented Jan 15, 2024

Hello!

I appreciate the desire to contribute, but this is skipping some necessary steps. New features should be first discussed in issues before making PRs. Could you open an issue to discuss this? In the meantime I'm going to close this.

Oh my bad, all right I did not know about that step first.

The issue has been created here: #3278

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

Successfully merging this pull request may close these issues.

2 participants