Path to the temporary directory on the device. 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.
Examples:
- iOS:
NSTemporaryDirectory() - Android:
getCacheDir()on the context.
Source
static Future<Directory> getTemporaryDirectory() async {
Map<String, dynamic> result = await PlatformMessages.invokeMethod(
_kChannelName, 'PathProvider.getTemporaryDirectory');
if (result == null)
return null;
return new Directory(result['path']);
}