getCacheRoot method

Future<Directory> getCacheRoot()

获取缓存根目录

Implementation

Future<Directory> getCacheRoot() async {
  if (_cacheRoot != null) return _cacheRoot!;

  final appSupport = await getApplicationSupportDirectory();
  _cacheRoot = Directory(p.join(appSupport.path, 'media_cache'));

  if (!await _cacheRoot!.exists()) {
    await _cacheRoot!.create(recursive: true);
  }

  return _cacheRoot!;
}