fromJson static method

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

Creates a new TransactionPartner object. This method decides which TransactionPartner subclass to use based on the type field.

Implementation

static TransactionPartner fromJson(Map<String, dynamic> json) {
  return switch (TransactionPartnerType.fromJson(json['type'])) {
    TransactionPartnerType.fragment =>
      TransactionPartnerFragment.fromJson(json),
    TransactionPartnerType.user => TransactionPartnerUser.fromJson(json),
    TransactionPartnerType.other => TransactionPartnerOther.fromJson(json),
    TransactionPartnerType.telegramAds =>
      TransactionPartnerTelegramAds.fromJson(json),
    TransactionPartnerType.affiliateProgram =>
      TransactionPartnerAffiliateProgram.fromJson(json),
    TransactionPartnerType.telegramApi =>
      TransactionPartnerTelegramApi.fromJson(json),
  };
}