fromis_9/app/lib/models/album.dart

47 lines
1.2 KiB
Dart
Raw Normal View History

/// 앨범 모델
library;
class Album {
final int id;
final String title;
final String? albumType;
final String? albumTypeShort;
final String? releaseDate;
final String? coverOriginalUrl;
final String? coverMediumUrl;
final String? coverThumbUrl;
final String? folderName;
final String? description;
Album({
required this.id,
required this.title,
this.albumType,
this.albumTypeShort,
this.releaseDate,
this.coverOriginalUrl,
this.coverMediumUrl,
this.coverThumbUrl,
this.folderName,
this.description,
});
factory Album.fromJson(Map<String, dynamic> json) {
return Album(
id: json['id'] as int,
title: json['title'] as String,
albumType: json['album_type'] as String?,
albumTypeShort: json['album_type_short'] as String?,
releaseDate: json['release_date'] as String?,
coverOriginalUrl: json['cover_original_url'] as String?,
coverMediumUrl: json['cover_medium_url'] as String?,
coverThumbUrl: json['cover_thumb_url'] as String?,
folderName: json['folder_name'] as String?,
description: json['description'] as String?,
);
}
/// 발매 년도 추출
String? get releaseYear => releaseDate?.substring(0, 4);
}