You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
xuxiaocheng0201
changed the title
feat: save_when in HydratedBloc.
feat: saveWhen in HydratedBloc.
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 asbuildWhen
inBlocBuilder
.Alternatives Considered
Or provide both
currentState
andnextState
parameters intoJson
method.The text was updated successfully, but these errors were encountered: