fromJson static method

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

Implementation

static UpgradedGiftColors? fromJson(Map<String, dynamic>? json) {
  if (json == null) {
    return null;
  }

  return UpgradedGiftColors(
    id: int.tryParse((json['id'] as dynamic)?.toString() ?? '') ?? 0,
    modelCustomEmojiId:
        int.tryParse(
          (json['model_custom_emoji_id'] as dynamic)?.toString() ?? '',
        ) ??
        0,
    symbolCustomEmojiId:
        int.tryParse(
          (json['symbol_custom_emoji_id'] as dynamic)?.toString() ?? '',
        ) ??
        0,
    lightThemeAccentColor: (json['light_theme_accent_color'] as int?) ?? 0,
    lightThemeColors: List<int>.from(
      tdListFromJson(
        json['light_theme_colors'],
      ).map((item) => int.tryParse((item as dynamic)?.toString() ?? '') ?? 0),
    ),
    darkThemeAccentColor: (json['dark_theme_accent_color'] as int?) ?? 0,
    darkThemeColors: List<int>.from(
      tdListFromJson(
        json['dark_theme_colors'],
      ).map((item) => int.tryParse((item as dynamic)?.toString() ?? '') ?? 0),
    ),
  );
}