PMU_PIbd32_Kamcharova_K.A/lib/data/dtos/character_dto.dart

24 lines
585 B
Dart
Raw Normal View History

2024-12-21 20:38:35 +04:00
import 'package:json_annotation/json_annotation.dart';
part 'character_dto.g.dart';
@JsonSerializable(createToJson: false)
class CharacterDto {
final String name;
final String type;
final String backstory;
@JsonKey(name: 'image_url')
final String imageUrl;
bool isLiked;
CharacterDto({
required this.name,
required this.type,
required this.backstory,
required this.imageUrl,
this.isLiked = false,
});
String get typeString => type ?? 'Unknown Type';
factory CharacterDto.fromJson(Map<String, dynamic> json) => _$CharacterDtoFromJson(json);
}