mapToGroupEvent static method

dynamic mapToGroupEvent(
  1. dynamic eventType,
  2. dynamic incomingData,
  3. bool includeRaw
)

Implementation

static dynamic mapToGroupEvent(eventType, incomingData, bool includeRaw) {
  final metaAndRaw = buildChatGroupEventMetaAndRaw(incomingData, includeRaw);
  final groupEvent = {
    'event': eventType,
    'origin': incomingData['messageOrigin'],
    'timestamp': incomingData['timestamp'],
    'chatId': incomingData['chatId'],
    'from': incomingData['from'],
    'meta': metaAndRaw['meta'],
  };

  if (includeRaw) {
    groupEvent['raw'] = metaAndRaw['raw'];
  }

  return groupEvent;
}