fromJson static method

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

Implementation

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

  return AccentColor(
    id: (json['id'] as int?) ?? 0,
    builtInAccentColorId: (json['built_in_accent_color_id'] as int?) ?? 0,
    lightThemeColors: List<int>.from(
      tdListFromJson(
        json['light_theme_colors'],
      ).map((item) => int.tryParse((item as dynamic)?.toString() ?? '') ?? 0),
    ),
    darkThemeColors: List<int>.from(
      tdListFromJson(
        json['dark_theme_colors'],
      ).map((item) => int.tryParse((item as dynamic)?.toString() ?? '') ?? 0),
    ),
    minChannelChatBoostLevel:
        (json['min_channel_chat_boost_level'] as int?) ?? 0,
  );
}