saveProtobufMessageToFileJSON static method
Future<void>
saveProtobufMessageToFileJSON(
- String filePath,
- GeneratedMessage message
)
Implementation
static Future<void> saveProtobufMessageToFileJSON(String filePath, GeneratedMessage message) async
{
// Convert the protobuf message to JSON
var spaces = ' ' * 4;
var encoder = JsonEncoder.withIndent(spaces);
String jsonString = encoder.convert(message.toProto3Json());
// Write the JSON string to a file
File file = File(filePath);
await file.writeAsString(jsonString);
}