getDirectoryPath static method

Future<String> getDirectoryPath(
  1. String dirName
)

This method asynchronously retrieves the application's documents directory path using getApplicationDocumentsDirectory, and then constructs a directory path by concatenating the documents path with the provided dirName. The resulting directory path is returned as a Future-wrapped String.

Implementation

static Future<String> getDirectoryPath(String dirName) async {
  final Directory appDocumentsDir = await getApplicationDocumentsDirectory();
  String appDocumentsPath = appDocumentsDir.path;
  String filePath = path.join(appDocumentsPath, dirName);
  return filePath;
}