ChatBoostSource.fromJson constructor

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

Creates a ChatBoostSource object from a JSON object.

Implementation

factory ChatBoostSource.fromJson(Map<String, dynamic> json) {
  return switch (ChatBoostSourceType.fromJson(json['type'])) {
    ChatBoostSourceType.premium => ChatBoostSourcePremium.fromJson(json),
    ChatBoostSourceType.giftCode => ChatBoostSourceGiftCode.fromJson(json),
    ChatBoostSourceType.giveaway => ChatBoostSourceGiveaway.fromJson(json),
  };
}