24 lines
585 B
Dart
24 lines
585 B
Dart
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);
|
|
}
|