MessageResponse.fromJson constructor

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

Creates a MessageResponse from a JSON map.

Maps each entry in the history list to a RichMessage object.

Implementation

factory MessageResponse.fromJson(Map<String, dynamic> json) =>
    MessageResponse(
      count: json['count'] as int? ?? 0,
      history: json['history'] != null
          ? List<RichMessage>.from(
              (json['history'] as List).map(
                (e) => RichMessage.fromJson(e as Map<String, dynamic>),
              ),
            )
          : [],
      metaData: json['meta_data'] != null
          ? Map<String, dynamic>.from(json['meta_data'])
          : {},
    );