- 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
618 B
Dart
22 lines
618 B
Dart
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
|
|
|
import 'package:conduit/core/models/prompt.dart';
|
|
import 'package:conduit/core/services/prompts_service.dart';
|
|
|
|
part 'prompts_providers.g.dart';
|
|
|
|
@Riverpod(keepAlive: true)
|
|
Future<List<Prompt>> promptsList(Ref ref) async {
|
|
final promptsService = ref.watch(promptsServiceProvider);
|
|
if (promptsService == null) return const <Prompt>[];
|
|
return promptsService.getPrompts();
|
|
}
|
|
|
|
@Riverpod(keepAlive: true)
|
|
class ActivePromptCommand extends _$ActivePromptCommand {
|
|
@override
|
|
String? build() => null;
|
|
|
|
void set(String? command) => state = command;
|
|
}
|