resume method

Future<bool> resume({
  1. bool useMemory = false,
  2. bool isFailTip = true,
})

Implementation

Future<bool> resume({
  bool useMemory = false,
  bool isFailTip = true,
}) async {
  await checkOrCreateDustbin;

  final bool exists = await dustbinExists;

  if (exists && !useMemory) {
    await File(dustbinPath).rename(path);
    logger.info('resume $path from $dustbinPath');
    return true;
  } else if (exists && useMemory && content != null) {
    await Future.wait([
      File(dustbinPath).delete(),
      File(path).writeAsBytes(content!),
    ]);
    logger.info('resume $path from $dustbinPath');
    return true;
  } else if (content != null) {
    await File(path).writeAsBytes(content!);
    logger.info('resume $path from $dustbinPath');
    return true;
  } else if (isFailTip) {
    logger.warning(className, 'resume失败,dustbin和memory中不存在$path', StackTrace.current);
  }
  return false;
}