fromJson static method

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

Implementation

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

  return Game(
    id: int.tryParse((json['id'] as dynamic)?.toString() ?? '') ?? 0,
    shortName: (json['short_name'] as String?) ?? '',
    title: (json['title'] as String?) ?? '',
    text: FormattedText.fromJson(tdMapFromJson(json['text'])),
    description: (json['description'] as String?) ?? '',
    photo: Photo.fromJson(tdMapFromJson(json['photo'])),
    animation: Animation.fromJson(tdMapFromJson(json['animation'])),
  );
}