fromJson static method

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

Implementation

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

  return DraftMessage(
    replyTo: InputMessageReplyTo.fromJson(
        json['reply_to'] as Map<String, dynamic>?),
    date: (json['date'] as int?) ?? 0,
    content: DraftMessageContent.fromJson(
        json['content'] as Map<String, dynamic>?)!,
    effectId: (json['effect_id'] is int
            ? json['effect_id'] as int
            : int.tryParse(json['effect_id']?.toString() ?? '')) ??
        0,
    suggestedPostInfo: InputSuggestedPostInfo.fromJson(
        json['suggested_post_info'] as Map<String, dynamic>?),
  );
}