An abstract class that provides methods for storing, fetching and removing json files from local storage.
Throws an UnsupportedPlatformException if the platform is not supported.
Constructors
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
- homeDirectory → Directory
-
Fetches the home directory of the current user.
no setter
Static Methods
-
removeFile(
{required String fileName, required String localStoragePath}) → Future< void> - Removes a file from the local storage. If the file does not exist, nothing will happen.
-
storeJsonFile(
{required String fileName, required Map< String, dynamic> json, required String localStoragePath}) → Future<void> - Stores a json file in the local storage. If the file already exists it will be overwritten.
-
tryFetchAndDeserializeJsonFile<
T> ({required String fileName, required String localStoragePath, required T fromJson(Map< String, dynamic> json)}) → Future<T?> - Tries to fetch and deserialize a json file from the local storage. If the file does not exist or if an error occurs during reading or deserialization, null will be returned.