toMap method

Map<String, dynamic> toMap(
  1. {int? nodeId}
)

Converts this event to a Map that can be encoded with StandardMessageCodec.

nodeId is the unique identifier of the semantics node associated with the event, or null if the event is not associated with a semantics node.

Implementation

Map<String, dynamic> toMap({ int? nodeId }) {
  final Map<String, dynamic> event = <String, dynamic>{
    'type': type,
    'data': getDataMap(),
  };
  if (nodeId != null) {
    event['nodeId'] = nodeId;
  }

  return event;
}