PretJsonManager class abstract

Constructors

PretJsonManager()

Properties

dataFile File
final
dropFields Map<String, List<String>>
To drop old fields when writing new versions, please add an entry to this map with the format:
final
freshJson Map
Please include your schemaVersion under a key name of schema.
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
schemaVersion String
The schema version of your app.
final

Methods

dangerousJsonReplace(Map<String, Map> newData) → void
Extremely dangerous function - replace the entire data file with freshJson. Customize the new data using newData - this expects a Map of form:
jsonWriteWrapper(Map fn(dynamic initialData)) → void
A wrapper function that takes care of loading and writing JSON. Pass in a function that takes in the existing data and returns your desired new data, and the wrapper will take care of the rest. Where possible, use writeDataToJson instead - it provides a safer and more high-level API.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pretLoadJson() → dynamic
toString() String
A string representation of this object.
inherited
writeDataToJson(Map<String, PretDataclass> data, String fieldName) → void
Persist new data to a top-level field in the JSON data file, given data and field name. Throws a ArgumentError if the field name is not found in the JSON file.

Operators

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

Constants

encoder → const JsonEncoder
JsonEncoder.withIndent(' ')