In Flutter, How to open a folder in native file explorer for the user, so that the user can browse its files/folders

Viewed 1797

I am building a file locker app in flutter which can lock files as well a folders. When a user unlocks a folder I want my app to show an option to view folder contents but in native file explorer. Is there any way to implement this feature?

(Thanks in advance..)

1 Answers

You can try this package for the use case you've mentioned: open_file

Usage:

import 'package:open_file/open_file.dart';
import 'package:path_provider/path_provider.dart';

//Get the path to the directory
final String dir = (await getTemporaryDirectory()).path;

//Use the path to launch the directory with the native file explorer
await OpenFile.open('$dir\\');

(Note: Tested on windows OS only)

Related