aboutsummaryrefslogtreecommitdiffstats
path: root/lib/data/data_providers/playlist_art_notifier.dart
blob: 417aa9a3443f7c862f4f7d09a10cdb309d172ec1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import 'package:flutter_ics_homescreen/export.dart';

class PlaylistArtNotifier extends Notifier<Map<int, Uint8List>> {
  @override
  Map<int, Uint8List> build() {
    return {};
  }

  void update(int position, Uint8List art) {
    // Having to copy the Map to trigger notification seems not particularly
    // efficient, it may make sense to notify against the last position
    // updated or similar...
    state[position] = art;
    state = Map.of(state);
  }

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