Switch to lazyBox

This commit is contained in:
Matthias Rupp
2022-10-17 16:40:51 +02:00
parent d310c77fc8
commit d08475d5af
6 changed files with 23 additions and 22 deletions

View File

@@ -15,7 +15,7 @@ class AlbumNotifier extends StateNotifier<List<AlbumResponseDto>> {
getAllAlbums() async {
if (_albumCacheService.isValid() && state.isEmpty) {
state = await _albumCacheService.getAsync();
state = await _albumCacheService.get();
}
List<AlbumResponseDto>? albums =

View File

@@ -15,9 +15,9 @@ class AlbumCacheService extends JsonCache<List<AlbumResponseDto>> {
}
@override
List<AlbumResponseDto> get() {
Future<List<AlbumResponseDto>> get() async {
try {
final mapList = readRawData() as List<dynamic>;
final mapList = await readRawData() as List<dynamic>;
final responseData = mapList
.map((e) => AlbumResponseDto.fromJson(e))