getImagesDirectoryPath function
Get directory for app Images private storage
Implementation
Future<Directory> getImagesDirectoryPath() async {
Directory? theImagesDirectory = _imagesDirectory;
if (theImagesDirectory != null) {
return theImagesDirectory;
}
final Directory directory = await getApplicationSupportDirectory();
final Directory imagesDirectory = Directory(join(directory.path, 'images'));
if (!await imagesDirectory.exists()) {
await imagesDirectory.create(recursive: true);
}
_imagesDirectory = imagesDirectory;
return imagesDirectory;
}