hydrated_mobx library
An extension to package:mobx which automatically persists and restores mobx states. Built to work with package:mobx.
Get started at mobx.dev 🚀
Classes
- HydratedAesCipher
- Default encryption algorithm. Uses AES256 CBC with PKCS7 padding.
- HydratedCipher
- Abstract cipher can be implemented to customize encryption.
- HydratedJson
-
Helpers for type-safe fromJson / toJson implementations to avoid manual
type checks and try/catch when reading from
Map<String, dynamic>. - HydratedMobX
-
An abstract class which enables automatic state persistence for classes
using
Store. State can be persisted across hot restarts and app restarts. - HydratedStorage
- Implementation of Storage which uses package:hive_ce to persist and retrieve state changes from the local device.
- HydratedStorageDirectory
- A platform-agnostic storage directory representation.
- Storage
- Interface which is used to persist and retrieve state changes.
Enums
- HydrationErrorBehavior
- Determines how persistence should proceed when hydration fails.
Functions
-
defaultOnHydrationError(
Object error, StackTrace stackTrace) → HydrationErrorBehavior - Default OnHydrationError handler. Returns HydrationErrorBehavior.overwrite.
Typedefs
- OnHydrationError = HydrationErrorBehavior Function(Object error, StackTrace stackTrace)
- Signature for a callback invoked when hydration fails. Returns a HydrationErrorBehavior to control how subsequent state changes are persisted.
Exceptions / Errors
- HydratedCyclicError
- Reports that an object could not be serialized due to cyclic references. When the cycle is detected, a HydratedCyclicError is thrown.
- HydratedUnsupportedError
- Reports that an object could not be serialized. The unsupportedObject field holds object that failed to be serialized.
- StorageNotFound
- Exception thrown if there was no HydratedStorage specified. This is most likely due to forgetting to setup the HydratedStorage: