localFile function

Future<File> localFile(
  1. String name, [
  2. String? doc
])

Implementation

Future<File> localFile(String name, [String? doc]) async {
  var p0 = File('${await localPath}/${name}');
  if (doc != null) return p0 = File('${await localPath}/${name}');

  if (await p0.exists()) return p0;
  final p1 =
      File('${await localPath}/${name.replaceAll(RegExp(r'[^\w]+'), '_')}.img');
  if (await p1.exists() || useOldImgEncoding) return p1;
  return File(
      '${await localPath}/${name.replaceAll(RegExp(r'[^\w]+'), '_')}.maybe.jpg');
}