PersistSignal<T>.sync constructor
PersistSignal<T>.sync ({
- required T read(),
- required FutureOr<
void> write(- T value
- bool lazy,
- Duration? throttle,
- JoltDebugOption? debug,
Creates a synchronous persistent signal.
Parameters:
read: Sync function to read from storagewrite: Function to write to storagelazy: Defer loading until first access (default: false)throttle: Delay before writing (null = no throttling)debug: Optional debug options
Example:
final theme = PersistSignal.sync(
read: () => prefs.getString('theme') ?? 'light',
write: (value) => prefs.setString('theme', value),
);
Implementation
factory PersistSignal.sync({
required T Function() read,
required FutureOr<void> Function(T value) write,
bool lazy,
Duration? throttle,
JoltDebugOption? debug,
}) = SyncPersistSignalImpl<T>;