autosave function

Future<void> autosave(
  1. SaveData saveData,
  2. String savePath
)

Creates a save and writes it to the unique file.

Implementation

Future<void> autosave(SaveData saveData, String savePath) async {
  final savePath_ = await _getAutoSavePath(savePath);
  final saveFile = await File(savePath_).create(recursive: true);

  final data = {
    'scene_id': saveData.sceneId,
    'description': 'autosave_${DateTime.now()}',
    'state': saveData.state
  };
  await saveFile.writeAsString(jsonEncode(data));
}