NewsDto.fromJson constructor

NewsDto.fromJson(
  1. Map<String, dynamic> json
)

Implementation

factory NewsDto.fromJson(Map<String, dynamic> json) {
  return NewsDto(
    id: json["id"] as String,
    title: json["title"] as String?,
    text: json["text"] as String?,
    imageResource: json["imageResource"] as String?,
    activatedAt: json["activatedAt"] == null
        ? null
        : DateTime.parse(json["activatedAt"] as String),
    stores: (json["stores"] as List<dynamic>?)
        ?.map((e) => NewsStoreDto.fromJson(e as Map<String, dynamic>))
        .toList(),
  );
}