getCacheDir method

Future<Directory> getCacheDir()

Ensures the cache directory exists and returns it.

Implementation

Future<Directory> getCacheDir() async {
  if (_initialized && _cacheDir != null) return _cacheDir!;
  final appDir = await getApplicationDocumentsDirectory();
  final dir = Directory('${appDir.path}/qfc4_fonts');
  if (!dir.existsSync()) {
    await dir.create(recursive: true);
  }
  _cacheDir = dir;
  _initialized = true;
  return dir;
}