mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-12 23:45:18 +00:00
33 lines
1002 B
Dart
33 lines
1002 B
Dart
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
import 'package:spotube/models/metadata/metadata.dart';
|
|
import 'package:spotube/provider/metadata_plugin/metadata_plugin_provider.dart';
|
|
import 'package:spotube/provider/metadata_plugin/utils/family_paginated.dart';
|
|
|
|
class MetadataPluginArtistAlbumNotifier
|
|
extends FamilyPaginatedAsyncNotifier<SpotubeSimpleAlbumObject, String> {
|
|
@override
|
|
Future<SpotubePaginationResponseObject<SpotubeSimpleAlbumObject>> fetch(
|
|
int offset,
|
|
int limit,
|
|
) async {
|
|
return await (await metadataPlugin).artist.albums(
|
|
arg,
|
|
limit: limit,
|
|
offset: offset,
|
|
);
|
|
}
|
|
|
|
@override
|
|
build(arg) async {
|
|
ref.watch(metadataPluginProvider);
|
|
return await fetch(0, 20);
|
|
}
|
|
}
|
|
|
|
final metadataPluginArtistAlbumsProvider = AsyncNotifierProviderFamily<
|
|
MetadataPluginArtistAlbumNotifier,
|
|
SpotubePaginationResponseObject<SpotubeSimpleAlbumObject>,
|
|
String>(
|
|
() => MetadataPluginArtistAlbumNotifier(),
|
|
);
|