shared_preferences_stateful_service_cache

Creator: coderz1093

Last updated:

0 purchases

TODO
Add to Cart

Description:

shared preferences stateful service cache

shared_preferences-based cache implementation for stateful_service.
Getting started #
See the stateful_service package documentation for more information on how to get started.
Once you have a StatefulService, you can use SharedPreferencesStatefulServiceCache to cache the
service's state using SharedPreferences.
class UserService extends StatefulService<User> {
UserService({required super.initialState})
: super(
cache: SharedPreferencesStatefulServiceCache(
key: 'userServiceState',
encode: (user) => user.name,
decode: (name) => User(name: name),
),
);

...
}
copied to clipboard
Caveats #
Since shared_preferences keeps all its data in memory, it's not recommended to use this cache for
services with large states. In such cases, consider using a different cache implementation.

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.

Related Products

More From This Creator