// lib/models/playlist_summary.dart /// 歌单列表用的轻量摘要(不加载歌单内全部歌曲) class PlaylistSummary { final String id; final String name; final int songCount; /// 封面:取歌单里第一首有封面的歌 final String? coverPath; final int updatedAt; const PlaylistSummary({ required this.id, required this.name, this.songCount = 0, this.coverPath, this.updatedAt = 0, }); factory PlaylistSummary.fromRow(Map row) { final cover = (row['cover_path'] as String?)?.trim() ?? ''; return PlaylistSummary( id: row['id'] as String? ?? '', name: (row['name'] as String?)?.trim() ?? '', songCount: (row['song_count'] as num?)?.toInt() ?? 0, coverPath: cover.isEmpty ? null : cover, updatedAt: (row['updated_at'] as num?)?.toInt() ?? 0, ); } bool get isEmpty => songCount == 0; }