How to create folder in Flutter

MIB Coder
1 min readSep 14, 2019

--

What you are going to learn: How to create folder in Flutter

folder creation in Flutter

These are four steps to create folder in Flutter:

1- Get application directory where it is installed.

final Directory _appDocDir = await getApplicationDocumentsDirectory();

2- Next append folder name with that directory path

final Directory _appDocDirFolder = Directory(‘${_appDocDir.path}/$folderName/’);

3- Check if that folder already exists then simply return its path

if(await _appDocDirFolder.exists()){ return _appDocDirFolder.path; }

4- If not exists then create folder and return its path

final Directory _appDocDirNewFolder=await _appDocDirFolder.create(recursive: true); 
return _appDocDirNewFolder.path;

Here is complete code:

folder creation in Flutter

Finally how to use above “Folder Creation” method

to call folder creation method

--

--