24 lines
585 B
Dart
Raw Permalink Normal View History

2024-12-21 19:38:35 +03: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);
}