mapRecordToJson function

Map<String, dynamic>? mapRecordToJson(
  1. Record? record
)

Maps any Records known to this Protocol to their JSON representation

Throws in case the record type is not known.

This method will return null (only) for null inputs.

Implementation

Map<String, dynamic>? mapRecordToJson(Record? record) {
  if (record == null) {
    return null;
  }
  if (record is (String, String)) {
    return {
      "p": [record.$1, record.$2],
    };
  }
  throw Exception('Unsupported record type ${record.runtimeType}');
}