PersistentDouble class

The PersistentDouble is meant to be used to store a value of type double.

This class extends the PersistentValue, so that, every time a new value is set, this is both stored in the database (if the flag continuousSave is set to true ) and sent to the stream to drive a StreamBuilder or a ValueBuilder to update the UI.

  • table is set by default to 'kvp', so that if not specified, all the instances of a PersistentValue derived class, will store their values to the same table.

  • persistentKey is the key associated to the PersistentValue derived entity.

  • initialData is used when no record is found in the database to make an insert with the first key/value pair having as key the argument passed to the persistentKey parameter and for value the argument passed to the initialData parameter.

  • continuousSave is set by default to true, so that every time to the persistentString is given a new value, the record in the db will be updated. If set to false, to update the record in the db, it is necessary to call the save method.



PersistentDouble({@required String persistentKey, String table: 'kvp', double initialData, bool continuousSave: true})


continuousSave → bool
This flag indicates if the new value needs to be saved on every update. If set to false, it is necessary to call the save method to store the value to the database. By default is true.
final, inherited
hashCode → int
The hash code for this object.
read-only, inherited
initialData ↔ double
The initial event of the stream
read / write, inherited
inStream → Function
Sink for the stream
read-only, inherited
onError → Function
Callback to handle the errors
final, inherited
outStream → Stream<double>
Stream getter
read-only, inherited
persistentKey → String
final, inherited
runtimeType → Type
A representation of the runtime type of the object.
read-only, inherited
stream BehaviorSubject<double>
Stream of type BehaviorSubject in order to emit the last event to every new listener.
read / write, inherited
table → String
final, inherited
timesUpdated ↔ int
timesUpdate shows how many times the stream got updated
read / write, inherited
value ↔ double
Getter for the last value emitted by the stream
read / write, inherited


debugMode() → void
To enable the debug mode
dispose() → void
init({DbProvider dbProvider}) → Future<void>
This method takes as a parameter an initialiazed instance of a DbProvider, initialize the KeyValueProvider that creates the table in which they key/value pairs are stored. [...]
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
onChange(dynamic onDataChanged(double data)) → void
To set a function that will be called every time the stream updates.
refresh() → void
Method to refresh the stream (e.g to use when the type it is not a basic type, and a property of an object has changed).
save() → Future<void>
This method needs to be used whern continuousSave is set to false, to store update the value in the database.
toString() → String
Returns a string representation of this object.


operator ==(dynamic other) → bool
The equality operator.