InteractionReceipt.fromMap constructor

InteractionReceipt.fromMap(
  1. dynamic map
)

Creates a new InteractionReceipt instance from a map.

Implementation

factory InteractionReceipt.fromMap(dynamic map) {
  late int messageId;
  if (Platform.isAndroid) {
    messageId = map['messageId'] ?? 0;
  } else if (Platform.isIOS) {
    messageId = int.parse(map['messageId'] ?? '0');
  } else {
    messageId = map['messageId'] ?? 0;
  }
  return InteractionReceipt(
    messageId: messageId,
    sender: User.fromMap(map['sender']),
    receiverType: map['receiverType'],
    receiverId: map['receiverId'],
    interactions: map['interactions'] != null
        ? (map['interactions'])
            .map<Interaction>((optionMap) => Interaction.fromMap(optionMap))
            .toList()
        : null,
  );
}