23 lines
502 B
Dart
23 lines
502 B
Dart
|
class HeroDto {
|
||
|
final int id;
|
||
|
final String name;
|
||
|
final String? portraitUrl;
|
||
|
final String? description;
|
||
|
|
||
|
HeroDto({
|
||
|
required this.id,
|
||
|
required this.name,
|
||
|
this.portraitUrl,
|
||
|
this.description,
|
||
|
});
|
||
|
|
||
|
factory HeroDto.fromJson(Map<String, dynamic> json) {
|
||
|
return HeroDto(
|
||
|
id: json['id'] as int,
|
||
|
name: json['name'] as String,
|
||
|
portraitUrl: json['images']?['icon_image_small'] as String?,
|
||
|
description: json['description']?['lore'] as String?,
|
||
|
);
|
||
|
}
|
||
|
}
|