getApplicationCacheDirectory function

Future<Directory> getApplicationCacheDirectory()

Path to a directory where the application may place application-specific cache files.

If this directory does not exist, it is created automatically.

Throws a MissingPlatformDirectoryException if the system is unable to provide the directory.

Implementation

Future<Directory> getApplicationCacheDirectory() async {
  final String? path = await _platform.getApplicationCachePath();
  if (path == null) {
    throw MissingPlatformDirectoryException(
        'Unable to get application cache directory');
  }
  return Directory(path);
}