getTemporaryDirectory function

Future<Directory> getTemporaryDirectory ()

Path to the temporary directory on the device that is not backed up and is suitable for storing caches of downloaded files.

Files in this directory may be cleared at any time. This does not return a new temporary directory. Instead, the caller is responsible for creating (and cleaning up) files or directories within this directory. This directory is scoped to the calling application.

On iOS, this uses the NSCachesDirectory API.

On Android, this uses the getCacheDir API on the context.


Future<Directory> getTemporaryDirectory() async {
  final String path = await _platform.getTemporaryPath();
  if (path == null) {
    return null;
  return Directory(path);