2025-09-30 14:39:22 +05:30
|
|
|
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
|
|
|
|
|
2025-08-19 20:26:19 +05:30
|
|
|
import 'package:conduit/core/models/tool.dart';
|
|
|
|
|
import 'package:conduit/core/services/tools_service.dart';
|
|
|
|
|
|
2025-09-30 14:39:22 +05:30
|
|
|
part 'tools_providers.g.dart';
|
|
|
|
|
|
2025-10-01 18:32:16 +05:30
|
|
|
@Riverpod(keepAlive: true)
|
2025-09-30 14:39:22 +05:30
|
|
|
Future<List<Tool>> toolsList(Ref ref) async {
|
2025-08-19 20:26:19 +05:30
|
|
|
final toolsService = ref.watch(toolsServiceProvider);
|
|
|
|
|
if (toolsService == null) return [];
|
|
|
|
|
return await toolsService.getTools();
|
2025-09-30 14:39:22 +05:30
|
|
|
}
|
2025-09-21 22:31:44 +05:30
|
|
|
|
2025-10-01 18:32:16 +05:30
|
|
|
@Riverpod(keepAlive: true)
|
2025-09-30 14:39:22 +05:30
|
|
|
class SelectedToolIds extends _$SelectedToolIds {
|
2025-09-21 22:31:44 +05:30
|
|
|
@override
|
|
|
|
|
List<String> build() => [];
|
|
|
|
|
|
|
|
|
|
void set(List<String> ids) => state = List<String>.from(ids);
|
|
|
|
|
}
|