import 'package:flutter_app/data/dtos/mangas_dto.dart'; import 'package:flutter_app/domain/models/carddata.dart'; import 'package:flutter_app/presentation/home_page/home_page.dart'; extension MangaDataDtoMapper on MangaDataDto { CardData toDomain() => CardData( title ?? 'UNKNOWN', imageUrl: images?.jpg?.image_url, id: id.toString(), descriptionText: 'Статус: ${status}. Рейтинг: ${score}. Людей поставило оценку: ${scored_by}', ); } extension MangasDtoToModel on MangasDto { HomeData toDomain() => HomeData( data: data?.map((e) => e.toDomain()).toList(), nextPage: (pagination?.hasNextPage ?? false) ? ((pagination?.currentPage ?? 0) + 1) : null); }