clearCache static method

Future<void> clearCache()

حذف كاش الخطوط من القرص.

Implementation

static Future<void> clearCache() async {
  if (kIsWeb) return;
  try {
    final appDir = await getApplicationDocumentsDirectory();
    final cacheDir = Directory('${appDir.path}/quran_fonts_cache');
    if (cacheDir.existsSync()) {
      await cacheDir.delete(recursive: true);
    }
  } catch (e) {
    log('QuranFontsService: clearCache failed: $e',
        name: 'QuranFontsService');
  }
  _loadedPages.clear();
  _pageLoadFutures.clear();
  _backgroundLoadFuture = null;
  _cacheDir = null;
  _cacheDirInitialized = false;
}