getCacheDir static method

Future<String> getCacheDir()

Get the cache directory, creating if needed.

Implementation

static Future<String> getCacheDir() async {
  if (_cacheDir != null) return _cacheDir!;

  final tempDir = await getTemporaryDirectory();
  _cacheDir = '${tempDir.path}/video_cache';

  final dir = Directory(_cacheDir!);
  if (!dir.existsSync()) {
    await dir.create(recursive: true);
  }

  return _cacheDir!;
}