saveToFile method

Future<Directory> saveToFile(
  1. Directory output
)

Implementation

Future<Directory> saveToFile(Directory output) async {
  if (!output.existsSync()) {
    await output.create(recursive: true);
  }

  String output_path = output.path;
  String output_first_name = output_path;
  // ignore: unused_local_variable
  String output_last_name = output_path;
  if ((output_path[output_path.length - 1] == Platform.pathSeparator)) {
    output_first_name = "${output_path}${first_name}";
    output_last_name = "${output_path}${last_name}";
  } else {
    output_first_name =
        "${output_path}${Platform.pathSeparator}${first_name}";
    output_last_name = "${output_path}${Platform.pathSeparator}${last_name}";
  }
  await File(output_first_name).writeAsString(first);
  if (is_isar) {
    // await File(output_last_name).writeAsString(last);
  }
  return output;
}