aboutsummaryrefslogtreecommitdiffstats
path: root/lib/data/data_providers/playlist_notifier.dart
blob: 293659184ea75bd8e3c117d2e5bd4f8bb9afd8e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import 'package:flutter_ics_homescreen/export.dart';

class PlaylistEntry {
  final String title;
  final String album;
  final String artist;
  final String file;
  final Duration duration;
  final int position;

  const PlaylistEntry(
      {required this.title,
      required this.album,
      required this.artist,
      required this.file,
      required this.duration,
      required this.position});
}

class PlaylistNotifier extends Notifier<List<PlaylistEntry>> {
  @override
  List<PlaylistEntry> build() {
    return [];
  }

  void update({required List<PlaylistEntry> newPlaylist}) {
    state = newPlaylist;
  }

  void add(PlaylistEntry entry) {
    state.add(entry);
  }

  void clear() {
    state = [];
  }
}