localPath function

Future<String> localPath({
  1. Future<Directory> fetchApplicationDirectory() = getApplicationDocumentsDirectory,
})

Implementation

Future<String> localPath(
    {Future<Directory> Function() fetchApplicationDirectory =
        getApplicationDocumentsDirectory}) async {
  final Directory directory = await fetchApplicationDirectory();
  final String dirPath = '${directory.path}/Pictures/sil-mobile';
  await Directory(dirPath).create(recursive: true);
  final String filePath = '$dirPath/{$DateTime.now()}.png';
  return filePath;
}