17 lines
483 B
Dart
17 lines
483 B
Dart
import '../dtos/hero_dto.dart';
|
|
|
|
class HeroMapper {
|
|
static 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?,
|
|
);
|
|
}
|
|
|
|
static List<HeroDto> fromJsonList(List<dynamic> jsonList) {
|
|
return jsonList.map((json) => fromJson(json as Map<String, dynamic>)).toList();
|
|
}
|
|
}
|