Search code examples
androidflutterlocal-storageflutter-dependencies

How to get Temporary Storage Directory in flutter?


I am creating a video app. So it generates thumbnail for every video. I want to store these thumbnail in local Storage of device(only temporary). So I want to get temporary path/Directory in device, where thumbnail will be stored. But I want to delete those thumbnails from Storage when user closes the app.

If you know the answer please answer the Question.


Solution

  • You can use path_provider,

    Directory tempDir = await getTemporaryDirectory();
    String tempPath = tempDir.path;
    
    Directory appDocDir = await getApplicationDocumentsDirectory();
    String appDocPath = appDocDir.path;