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: saveWhen in HydratedBloc. #4283

Open
xuxiaocheng0201 opened this issue Nov 19, 2024 · 0 comments
Open

feat: saveWhen in HydratedBloc. #4283

xuxiaocheng0201 opened this issue Nov 19, 2024 · 0 comments

Comments

@xuxiaocheng0201
Copy link

xuxiaocheng0201 commented Nov 19, 2024

Description

Currently, whenever the state changes, stoarge.write is called. code
(Although it doesn't write when toJson returns null, I actually don't know when to return null.)
But sometimes, certain fields in the state are not stored and these fields change very frequently, such as loading progress. In this case, saving every state change would result in a significant amount of unnecessary duplicate writes.

Desired Solution

A saveWhen method should be provided. Such as buildWhen in BlocBuilder.

Alternatives Considered

Or provide both currentState and nextState parameters in toJson method.

@xuxiaocheng0201 xuxiaocheng0201 changed the title feat: save_when in HydratedBloc. feat: saveWhen in HydratedBloc. Nov 19, 2024
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

1 participant