- Add @persistentRiverpod annotation for providers that need keepAlive - ThemeProvider now persists for app lifetime - Refactored API clients to use @persistentRiverpod - Documented in ARCHITECTURE.md 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
16 lines
578 B
Dart
16 lines
578 B
Dart
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
|
|
|
/// Riverpod annotation for providers that should persist for the app lifetime.
|
|
///
|
|
/// Use this instead of `@riverpod` when:
|
|
/// - The provider holds app-level state (theme, auth, config)
|
|
/// - The provider stores a Ref that must remain valid (API clients with interceptors)
|
|
/// - Disposing would cause flickering or re-initialization issues
|
|
///
|
|
/// Example:
|
|
/// ```dart
|
|
/// @persistentRiverpod
|
|
/// class ThemeNotifier extends _$ThemeNotifier { ... }
|
|
/// ```
|
|
const persistentRiverpod = Riverpod(keepAlive: true);
|