getStorageDirectory method

Future<Directory> getStorageDirectory()

Resolves the destination directory for on-demand recitation assets.

Implementation

Future<Directory> getStorageDirectory() async {
  if (customStoragePath != null) {
    final dir = Directory(customStoragePath!);
    if (!await dir.exists()) {
      await dir.create(recursive: true);
    }
    return dir;
  }
  final appDir = await getApplicationDocumentsDirectory();
  final dir = Directory(p.join(appDir.path, 'recite_quran_assets'));
  if (!await dir.exists()) {
    await dir.create(recursive: true);
  }
  return dir;
}