mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-13 07:55:18 +00:00

- Implemented ErrorBox for displaying error messages with retry functionality and log viewing. - Created NoDefaultMetadataPlugin to inform users about missing default metadata providers and provide navigation to manage them.
27 lines
899 B
Dart
27 lines
899 B
Dart
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
|
import 'package:spotube/models/metadata/metadata.dart';
|
|
import 'package:spotube/provider/metadata_plugin/metadata_plugin_provider.dart';
|
|
import 'package:spotube/services/metadata/errors/exceptions.dart';
|
|
|
|
final metadataPluginSearchAllProvider =
|
|
FutureProvider.autoDispose.family<SpotubeSearchResponseObject, String>(
|
|
(ref, query) async {
|
|
final metadataPlugin = await ref.watch(metadataPluginProvider.future);
|
|
|
|
if (metadataPlugin == null) {
|
|
throw MetadataPluginException.noDefaultPlugin();
|
|
}
|
|
|
|
return metadataPlugin.search.all(query);
|
|
},
|
|
);
|
|
|
|
final metadataPluginSearchChipsProvider = FutureProvider((ref) async {
|
|
final metadataPlugin = await ref.watch(metadataPluginProvider.future);
|
|
|
|
if (metadataPlugin == null) {
|
|
throw MetadataPluginException.noDefaultPlugin();
|
|
}
|
|
return metadataPlugin.search.chips;
|
|
});
|