21 lines
673 B
Dart
21 lines
673 B
Dart
import 'dart:convert';
|
|
|
|
import '../../models/CardData.dart';
|
|
import '../dtos/PlaceDTO.dart';
|
|
|
|
extension PlaceDataDtoToModel on PlaceDataDto {
|
|
CardData toDomain() => CardData(
|
|
name ?? 'Неизвестное имя',
|
|
//imageUrl: attributes?.image,
|
|
descriptionText: getText(),
|
|
//bytes: (imagedata != null) ? base64.decode(imagedata!) : null,
|
|
bytes: imageData ?? null,
|
|
id: id.toString()
|
|
);
|
|
String getText() {
|
|
final String str1 = description ?? "Описания нет";
|
|
final String str2 = yearBuilt?.toString() ?? "Даты построики нет";
|
|
return "$str1\n--------------\n$str2 год";
|
|
}
|
|
}
|