sharableFileCopy function

Future<File> sharableFileCopy({
  1. required String uuid,
  2. required File file,
  3. required String name,
})

Implementation

Future<File> sharableFileCopy({
  required String uuid,
  required File file,
  required String name,
}) async {
  final base = await _cleanAtStartup;

  final dir = base.dir(uuid);
  await dir.create(recursive: true);

  final copy = dir.file(name);

  if (!(await copy.exists())) {
    await file.copy(copy.path);
  }

  return copy;
}