50 lines
1.1 KiB
Dart
50 lines
1.1 KiB
Dart
// lib/models/media_info.dart
|
|
//
|
|
// Represents the currently playing track's metadata.
|
|
// Populated by NotificationListenerService via platform channel.
|
|
|
|
import 'dart:typed_data';
|
|
|
|
class MediaInfo {
|
|
final String title;
|
|
final String artist;
|
|
final String album;
|
|
final Uint8List? albumArt; // Raw bytes from notification
|
|
final bool isPlaying;
|
|
|
|
const MediaInfo({
|
|
required this.title,
|
|
required this.artist,
|
|
required this.album,
|
|
this.albumArt,
|
|
required this.isPlaying,
|
|
});
|
|
|
|
// Empty/idle state
|
|
static const empty = MediaInfo(
|
|
title: 'Nothing Playing',
|
|
artist: '',
|
|
album: '',
|
|
isPlaying: false,
|
|
);
|
|
|
|
MediaInfo copyWith({
|
|
String? title,
|
|
String? artist,
|
|
String? album,
|
|
Uint8List? albumArt,
|
|
bool? isPlaying,
|
|
}) {
|
|
return MediaInfo(
|
|
title: title ?? this.title,
|
|
artist: artist ?? this.artist,
|
|
album: album ?? this.album,
|
|
albumArt: albumArt ?? this.albumArt,
|
|
isPlaying: isPlaying ?? this.isPlaying,
|
|
);
|
|
}
|
|
|
|
@override
|
|
String toString() => 'MediaInfo(title: $title, artist: $artist, isPlaying: $isPlaying)';
|
|
}
|