Files
SpotiFLAC-Mobile/lib/controllers/library_tracks_folder_data.dart
T
zarzet 99ccc8826f refactor(layering): move logic files out of screens
Search bucketing, refresh policy, folder data, history snapshot and the
selection and collapsing-header mixins hold no widgets, so they move to
controllers; the settings search catalog is pure presentation metadata and
moves to utils. Files with many importers keep a re-export in screens.
2026-10-19 00:37:42 +07:00

23 lines
969 B
Dart

import 'package:spotiflac_android/models/track.dart';
import 'package:spotiflac_android/controllers/track_history_snapshot.dart';
import 'package:spotiflac_android/providers/library_collections_provider.dart';
import 'package:spotiflac_android/services/history_database.dart';
/// Collection providers replace their track list when its contents change.
/// Keep derived data across selection/layout rebuilds of the same snapshot.
class LibraryTracksFolderData {
List<CollectionTrackEntry>? _entries;
Set<String> keys = const {};
List<Track> tracks = const [];
final _history = TrackHistorySnapshot();
HistoryBatchLookupRequest get historyRequest => _history.request;
void update(List<CollectionTrackEntry> entries) {
if (identical(entries, _entries)) return;
_entries = entries;
keys = Set.unmodifiable(entries.map((entry) => entry.key));
tracks = List.unmodifiable(entries.map((entry) => entry.track));
_history.update(tracks);
}
}