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: (json['id'] is int
            ? json['id'] as int
            : int.tryParse(json['id']?.toString() ?? '')) ??
        0,
    shortName: (json['short_name'] as String?) ?? '',
    title: (json['title'] as String?) ?? '',
    text: FormattedText.fromJson(json['text'] as Map<String, dynamic>?)!,
    description: (json['description'] as String?) ?? '',
    photo: Photo.fromJson(json['photo'] as Map<String, dynamic>?)!,
    animation: Animation.fromJson(json['animation'] as Map<String, dynamic>?),
  );
}