IoWorkDb class

File system implementation for Desktop/Server platforms.

This implementation uses Dart's dart:io library to read and write files to the local file system. It's suitable for:

  • Windows
  • macOS
  • Linux
  • Server-side Dart applications

Usage

final fs = IoWorkDb('./data');
final db = ClientWorkDb.getInstance(fs);

File Structure

Data is stored as JSON files in a hierarchical structure:

<dataPath>/
└── WorkDB/
    └── <collection>/
        └── <itemId>  (JSON file)
Implemented types

Constructors

IoWorkDb(String pathDb)
Creates a new IoWorkDb with the specified base path.

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

deleteFile(String filePath) → Future<void>
Deletes a file at the specified path.
override
deleteFileSync(String filePath) → void
Deletes a file at the specified path synchronously.
override
deleteFolder(String folderPath) → Future<void>
Deletes a folder and all its contents recursively.
override
deleteFolderSync(String folderPath) → void
Deletes a folder and all its contents recursively, synchronously.
override
exist(String filePath) → Future<bool>
Checks if a file or folder exists at the specified path.
override
existSync(String filePath) → bool
Checks if a file or folder exists at the specified path synchronously.
override
getFile(String filePath) → Future<ItemOutput>
Reads an item from the specified path.
override
getFileSync(String filePath) → ItemOutput
Reads an item from the specified path synchronously.
override
getPath() → String
override
ls(String dirPath) → Future<List<String>>
Lists all files/items in a directory.
override
lsSync(String dirPath) → List<String>
Lists all files/items in a directory synchronously.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
renameFile(String oldPath, String newPath) → Future<void>
Renames/moves a file from one path to another.
override
renameFileSync(String oldPath, String newPath) → void
Renames/moves a file from one path to another synchronously.
override
toString() → String
A string representation of this object.
inherited
writeFile(String filePath, Item input) → Future<void>
Writes an item to the specified path.
override
writeFileSync(String filePath, Item input) → void
Writes an item to the specified path synchronously.
override

Operators

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