SwiftPersisted<T> class

Reactive value with persistence

Inheritance
Available extensions

Constructors

SwiftPersisted(T initialValue, String _key, StorageBackend _storage, {T fromJson(Map<String, dynamic>)?, Map<String, dynamic> toJson(T)?, List<MigrationConfig<T>>? migrations, int? currentVersion})

Properties

fromJson → T Function(Map<String, dynamic>)?
final
hashCode int
The hash code for this object.
no setterinherited
hasListeners bool
Whether any listeners are currently registered.
no setterinherited
rawValue → T
Gets the value without registering as dependency (for internal use)
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
toJson Map<String, dynamic> Function(T)?
final
value ↔ T
Gets the current value and registers this SwiftValue as a dependency
getter/setter pairinherited-getteroverride-setter

Methods

add(double value) → void

Available on Rx<double>, provided by the RxDoubleExtensions extension

Adds a value to the reactive double and updates it.
add(int value) → void

Available on Rx<int>, provided by the RxIntExtensions extension

Adds a value to the reactive integer and updates it.
add(String value) → void

Available on Rx<String>, provided by the RxStringExtensions extension

Adds (concatenates) a string to the reactive string and updates it.
addGST(double percent) → void

Available on Rx<double>, provided by the RxDoubleExtensions extension

Adds GST to the reactive double.
addGST(double percent) → void

Available on Rx<int>, provided by the RxIntExtensions extension

Adds GST to the reactive integer.
addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
applyPercent(double percent) → void

Available on Rx<double>, provided by the RxDoubleExtensions extension

Applies a percentage to the reactive double (adds percentage).
applyPercent(double percent) → void

Available on Rx<int>, provided by the RxIntExtensions extension

Applies a percentage to the reactive integer (adds percentage).
assertType([String? message]) Rx<T>

Available on Rx<T>, provided by the RxTypeSafety extension

Assert type at runtime
chain() ReactiveChain<T>

Available on Rx<T>, provided by the RxTypeSafety extension

Create a reactive chain
clear() Future<void>
Clear persisted value
discount(double percent) → void

Available on Rx<double>, provided by the RxDoubleExtensions extension

Applies a discount percentage to the reactive double (subtracts percentage).
discount(double percent) → void

Available on Rx<int>, provided by the RxIntExtensions extension

Applies a discount percentage to the reactive integer (subtracts percentage).
dispose() → void
Discards any resources used by the object. After this is called, the object is not in a usable state and should be discarded (calls to addListener will throw after the object is disposed).
inherited
migrate() Future<void>
Migrate data manually (useful for testing or manual migration)
mul(double value) → void

Available on Rx<double>, provided by the RxDoubleExtensions extension

Multiplies the reactive double by a value and updates it.
mul(int value) → void

Available on Rx<int>, provided by the RxIntExtensions extension

Multiplies the reactive integer by a value and updates it.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
notifyListenersTransaction() → void

Available on ChangeNotifier, provided by the TransactionNotifier extension

Notifies listeners, respecting transaction context.
removeGST(double percent) → void

Available on Rx<double>, provided by the RxDoubleExtensions extension

Removes GST from the reactive double.
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
roundTo(int decimals) → void

Available on Rx<double>, provided by the RxDoubleExtensions extension

Rounds the reactive double to a specified number of decimal places.
sub(double value) → void

Available on Rx<double>, provided by the RxDoubleExtensions extension

Subtracts a value from the reactive double and updates it.
sub(int value) → void

Available on Rx<int>, provided by the RxIntExtensions extension

Subtracts a value from the reactive integer and updates it.
tax(double percent) → void

Available on Rx<double>, provided by the RxDoubleExtensions extension

Applies a tax percentage to the reactive double (adds percentage).
tax(double percent) → void

Available on Rx<int>, provided by the RxIntExtensions extension

Applies a tax percentage to the reactive integer (adds percentage).
toggle() → void

Available on Rx<bool>, provided by the RxBoolExtensions extension

Toggles the reactive boolean value.
toString() String
A string representation of this object.
inherited
toTyped() TypedRx<T>

Available on Rx<T>, provided by the RxTypeSafety extension

Create a typed version
update(T newValue) → void
Updates the value and notifies listeners if changed
override

Operators

operator ==(Object other) bool
The equality operator.
inherited