PrinterStorage class
Tiny, dependency-injected friendly wrapper around the Hive box used by the SDK.
Host apps can either let the SDK open the box lazily or call PrinterSdk.initialize once during startup. If Hive cannot be initialized, every read returns its default and the SDK keeps working in-memory.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- isReady → bool
-
Whether the backing box is open and ready for synchronous reads.
no setter
-
revision
→ ValueNotifier<
int> -
Bumped after every write so widgets can rebuild when persisted values
change (for example, when a printer is connected).
final
Static Methods
-
clear(
) → Future< void> - Removes every key owned by the SDK.
-
delete(
String key) → Future< void> - Deletes a value and notifies listeners.
-
ensureInitialized(
) → Future< Box?> - Opens (or reuses) the configured Hive box.
-
read<
T> (String key, {T? defaultValue}) → T? -
Reads a value, returning
defaultValuewhen storage is unavailable. -
readBool(
String key, {bool defaultValue = false}) → bool - Reads a boolean with a sensible default.
-
readString(
String key, {String defaultValue = ''}) → String - Reads a string with a sensible default.
-
write(
String key, Object? value) → Future< void> - Writes a value and notifies listeners.