create static method

Future<FileStorageImpl> create(
  1. String category
)

Create a file storage instance with specified category as root directory.

If the directory does not exist, it will be created.

Implementation

static Future<FileStorageImpl> create(String category) async {
  final Directory rootDir = await getApplicationDocumentsDirectory();
  final Directory categoryDir = Directory(join(rootDir.path, category));

  if (!(await categoryDir.exists())) {
    await categoryDir.create();
  }

  return FileStorageImpl._(categoryDir);
}