- Changed multiple provider annotations to `@Riverpod(keepAlive: true)` to improve state retention and management across the application. - This update aligns with recent enhancements in state management practices, ensuring better performance and user experience throughout the app.
22 lines
601 B
Dart
22 lines
601 B
Dart
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
|
|
|
import 'package:conduit/core/models/tool.dart';
|
|
import 'package:conduit/core/services/tools_service.dart';
|
|
|
|
part 'tools_providers.g.dart';
|
|
|
|
@Riverpod(keepAlive: true)
|
|
Future<List<Tool>> toolsList(Ref ref) async {
|
|
final toolsService = ref.watch(toolsServiceProvider);
|
|
if (toolsService == null) return [];
|
|
return await toolsService.getTools();
|
|
}
|
|
|
|
@Riverpod(keepAlive: true)
|
|
class SelectedToolIds extends _$SelectedToolIds {
|
|
@override
|
|
List<String> build() => [];
|
|
|
|
void set(List<String> ids) => state = List<String>.from(ids);
|
|
}
|