fromJson static method

SavedMessagesTopic? fromJson(
  1. Map<String, dynamic>? json
)

Implementation

static SavedMessagesTopic? fromJson(Map<String, dynamic>? json) {
  if (json == null) {
    return null;
  }

  return SavedMessagesTopic(
    id: (json['id'] as int?) ?? 0,
    type: SavedMessagesTopicType.fromJson(
        json['type'] as Map<String, dynamic>?)!,
    isPinned: (json['is_pinned'] as bool?) ?? false,
    order: (json['order'] is int
            ? json['order'] as int
            : int.tryParse(json['order']?.toString() ?? '')) ??
        0,
    lastMessage:
        Message.fromJson(json['last_message'] as Map<String, dynamic>?),
    draftMessage:
        DraftMessage.fromJson(json['draft_message'] as Map<String, dynamic>?),
  );
}