LocalValue<T> class

Local persistance container. LocalValue is useful when storing many values (ex. storing multiple users by id). If storing singletons (ex. only storing the currently logged in user), consider using LocalSingleton

Inheritance

Constructors

LocalValue({DocumentType? documentType, T fromJson(Map<String, dynamic>)?, Map<String, dynamic> toJson(T)?, List<String>? basePath})
documentType specifies the storage path. see DocumentType. (NOTE: this value is ignored on web and always stores to DocumentType.prefs.) toJson and fromJson are required if storing a non-primative (NOT one of int, double, string, or Map<String, dynamic>). otherwise, defaults to identity functions. basePath specifies the path that the files are stored to. It is recommended to use this paramater, if only for style: This is because it is possible to polute the base directory & face collisions.
const

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

delete(String id) Future<bool>
deletes from storage according to LocalValue.basePath and LocalValue.documentType, returning true if an object existed at the path and was deleted from storage and false otherwise.
deleteValue(String fileName) Future<bool>
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
read(String id) Future<T?>
reads from storage according to LocalValue.basePath and LocalValue.documentType. returns null if nothing is at that path, T if otherwise.
readValue(String fileName) Future<T?>
inherited
toString() String
A string representation of this object.
inherited
write(String id, T toWrite) Future<void>
writes toWrite to storage according to LocalValue.basePath and LocalValue.documentType.
writeValue(String fileName, T toWrite) Future<void>
inherited

Operators

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