writeToOut function
Implementation
Future<void> writeToOut(
String jsonStr, {
String? fileName,
}) async {
if (fileName != null) {
final file = await File(fileName).create(recursive: true);
await file.writeAsString(jsonStr);
} else {
stdout.writeln(jsonStr);
}
}