writeToOut function

Future<void> writeToOut(
  1. String jsonStr, {
  2. String? fileName,
})

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);
  }
}