LatestReceiptState.fromJson constructor

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

Implementation

factory LatestReceiptState.fromJson(Map<String, dynamic> json) {
  final global = json['global'] ?? <String, dynamic>{};
  final Map<String, dynamic> main = json['main'] ?? <String, dynamic>{};
  final Map<String, dynamic> byThread = json['thread'] ?? <String, dynamic>{};

  return LatestReceiptState(
    global: LatestReceiptStateForTimeline.fromJson(global),
    mainThread:
        main.isNotEmpty ? LatestReceiptStateForTimeline.fromJson(main) : null,
    byThread: byThread.map(
        (k, v) => MapEntry(k, LatestReceiptStateForTimeline.fromJson(v))),
  );
}