handleChatGroupEvent static method

Future handleChatGroupEvent({
  1. required dynamic data,
  2. bool includeRaw = false,
})

Implementation

static Future<dynamic> handleChatGroupEvent({
  required dynamic data,
  bool includeRaw = false,
}) async {
  switch (data['eventType']) {
    case 'create':
      return mapToCreateGroupEvent(data, includeRaw);
    case 'update':
      return mapToUpdateGroupEvent(data, includeRaw);
    case GroupEventType.joinGroup:
      return mapToJoinGroupEvent(data, includeRaw);
    case GroupEventType.leaveGroup:
      return mapToLeaveGroupEvent(data, includeRaw);
    case MessageEventType.request:
      return mapToRequestEvent(data, includeRaw);
    case GroupEventType.remove:
      return mapToRemoveEvent(data, includeRaw);
    default:
      log('Unknown eventType: ${data['eventType']}');
      return data;
  }
}