initDirectory method

Future<Directory> initDirectory()

Initializes the directory in which files are persisted. This needs to be done on the main isolate as opposed to the worker since it requires access to plugins that are not easily available in the worker isolate context.

Implementation

Future<Directory> initDirectory() async {
  final applicationDirectory = await getApplicationDocumentsDirectory();
  final fileDirectory = Directory('${applicationDirectory.path}/loon');
  final directory = await fileDirectory.create();

  logger.log('Directory: ${directory.path}');

  return directory;
}