LatestReceiptStateForTimeline.fromJson constructor

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

Implementation

factory LatestReceiptStateForTimeline.fromJson(Map<String, dynamic> json) {
  final private = json['private'];
  final public = json['public'];
  final latest = json['latest'];
  final Map<String, dynamic>? others = json['others'];

  final Map<String, LatestReceiptStateData> byUser = others
          ?.map((k, v) => MapEntry(k, LatestReceiptStateData.fromJson(v))) ??
      {};

  return LatestReceiptStateForTimeline(
    ownPrivate:
        private != null ? LatestReceiptStateData.fromJson(private) : null,
    ownPublic:
        public != null ? LatestReceiptStateData.fromJson(public) : null,
    latestOwnReceipt:
        latest != null ? LatestReceiptStateData.fromJson(latest) : null,
    otherUsers: byUser,
  );
}