InfoResponse.fromJson constructor Null safety

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

Implementation

factory InfoResponse.fromJson(Map<String, dynamic> json) {
  Map<String, dynamic>? depositDynamic = json['deposit'] == null ? null : json['deposit'];

  Map<String, DepositAsset> depositMap = {};
  if (depositDynamic != null) {
    depositDynamic.forEach((key, value) {
      depositMap[key] = DepositAsset.fromJson(value);
    });
  }
  Map<String, dynamic>? withdrawDynamic = json['withdraw'] == null ? null : json['withdraw'];

  Map<String, WithdrawAsset> withdrawMap = {};
  if (withdrawDynamic != null) {
    withdrawDynamic.forEach((key, value) {
      withdrawMap[key] = WithdrawAsset.fromJson(value);
    });
  }

  return InfoResponse(
      depositMap,
      withdrawMap,
      json['fee'] == null ? null : AnchorFeeInfo.fromJson(json['fee']),
      json['transactions'] == null ? null : AnchorTransactionsInfo.fromJson(json['transactions']),
      json['transaction'] == null ? null : AnchorTransactionInfo.fromJson(json['transaction']));
}