persist method
Persists bundle and returns the location or message to surface.
Implementation
@override
Future<String> persist(CockpitRecordedFlowBundle bundle) async {
final caseId = bundle.caseDocument['id'];
if (caseId is! String || caseId.isEmpty) {
throw StateError('The export bundle carries no case id.');
}
final directory = Directory(_resolveDirectoryPath());
await directory.create(recursive: true);
final file = File('${directory.path}${Platform.pathSeparator}$caseId.yaml');
await file.writeAsString(bundle.caseYaml, flush: true);
return file.path;
}