mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-12 23:45:18 +00:00
32 lines
992 B
Dart
32 lines
992 B
Dart
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
import 'package:spotube/models/metadata/metadata.dart';
|
|
import 'package:spotube/provider/metadata_plugin/core/auth.dart';
|
|
import 'package:spotube/provider/metadata_plugin/utils/paginated.dart';
|
|
|
|
class MetadataPluginBrowseSectionsNotifier
|
|
extends PaginatedAsyncNotifier<SpotubeBrowseSectionObject<Object>> {
|
|
@override
|
|
Future<SpotubePaginationResponseObject<SpotubeBrowseSectionObject<Object>>>
|
|
fetch(
|
|
int offset,
|
|
int limit,
|
|
) async {
|
|
return await (await metadataPlugin).browse.sections(
|
|
limit: limit,
|
|
offset: offset,
|
|
);
|
|
}
|
|
|
|
@override
|
|
build() async {
|
|
ref.watch(metadataPluginAuthenticatedProvider);
|
|
return await fetch(0, 20);
|
|
}
|
|
}
|
|
|
|
final metadataPluginBrowseSectionsProvider = AsyncNotifierProvider<
|
|
MetadataPluginBrowseSectionsNotifier,
|
|
SpotubePaginationResponseObject<SpotubeBrowseSectionObject<Object>>>(
|
|
() => MetadataPluginBrowseSectionsNotifier(),
|
|
);
|