BackupStorage class
A controller
class handling read and write operations of backups to
local storage.
Backups are preferably stored on the device's Media directories (MediaLocation). The organizationName will be a directory in the Media directory, whereas the applicationName will be a subdirectory (inside the organizationName directory). This will help the user to organize different backups of different applications.
A organizationName
of MyOrganization
, a applicationName
of MyApp
and a fileName
of examplebackup
on the Documents
media directory would
compound a complete path of
/storage/emulated/0/Documents/MyOrganization/MyApp/examplebackup.json
.
Constructors
- BackupStorage({required String organizationName, required String applicationName, required String fileName, MediaLocation mediaLocation = MediaLocation.DOWNLOAD_LOCATION_ANDROID})
-
Creates a BackupStorage.
const
Properties
- applicationName → String
-
The application's name.
final
-
currentMediaPath
→ Future<
String> -
Retrieves the currently selected
Media
directory on the local device's file system.no setter - fileName → String
-
The file's name. The file extention will not be required, because all
backup files ẁill have the
json
extension exclusively by default.final - hashCode → int
-
The hash code for this object.
no setterinherited
- mediaLocation → MediaLocation
-
The MediaLocation to store the backup in.
final
- organizationName → String
-
The application's creator.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
deleteBackup(
) → Future< void> - Deletes the existing backup file.
-
hasPermissions(
) → Future< bool> - Evaluates whether all required permissions have been granted.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
readBackup(
{required BackupModel decode(String)}) → Future< BackupModel?> - Reads the backup from the selected location.
-
requestPermissions(
) → Future< void> - Request all required permissions to access the existing backup files stored on the Media locations.
-
toString(
) → String -
A string representation of this object.
inherited
-
writeBackup(
BackupModel backup) → Future< File> -
Creates a backup file based on the provided
BackupModel
's content.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited