fromJson static method
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 (json['type']) {
'fragment' => TransactionPartnerFragment.fromJson(json),
'user' => TransactionPartnerUser.fromJson(json),
'other' => TransactionPartnerOther.fromJson(json),
'telegram_ads' => TransactionPartnerTelegramAds.fromJson(json),
_ => throw ArgumentError('Invalid transaction partner type')
};
}