| .. | .. |
|---|
| 6 | 6 | import 'package:flutter_secure_storage/flutter_secure_storage.dart'; |
|---|
| 7 | 7 | |
|---|
| 8 | 8 | import '../models/message.dart'; |
|---|
| 9 | +import '../models/project.dart'; |
|---|
| 9 | 10 | import '../models/server_config.dart'; |
|---|
| 10 | 11 | import '../models/session.dart'; |
|---|
| 11 | 12 | import '../services/message_store.dart'; |
|---|
| .. | .. |
|---|
| 25 | 26 | |
|---|
| 26 | 27 | final serverConfigProvider = |
|---|
| 27 | 28 | StateNotifierProvider<ServerConfigNotifier, ServerConfig?>((ref) { |
|---|
| 28 | | - return ServerConfigNotifier(); |
|---|
| 29 | | -}); |
|---|
| 29 | + return ServerConfigNotifier(); |
|---|
| 30 | + }); |
|---|
| 30 | 31 | |
|---|
| 31 | 32 | class ServerConfigNotifier extends StateNotifier<ServerConfig?> { |
|---|
| 32 | 33 | ServerConfigNotifier() : super(null) { |
|---|
| .. | .. |
|---|
| 60 | 61 | |
|---|
| 61 | 62 | // --- Connection Status --- |
|---|
| 62 | 63 | |
|---|
| 63 | | -final wsStatusProvider = |
|---|
| 64 | | - StateProvider<ConnectionStatus>((ref) => ConnectionStatus.disconnected); |
|---|
| 64 | +final wsStatusProvider = StateProvider<ConnectionStatus>( |
|---|
| 65 | + (ref) => ConnectionStatus.disconnected, |
|---|
| 66 | +); |
|---|
| 65 | 67 | |
|---|
| 66 | 68 | final connectionDetailProvider = StateProvider<String>((ref) => ''); |
|---|
| 67 | 69 | final connectedViaProvider = StateProvider<String>((ref) => ''); |
|---|
| .. | .. |
|---|
| 83 | 85 | } |
|---|
| 84 | 86 | }); |
|---|
| 85 | 87 | |
|---|
| 88 | +// --- Projects (PAI project launcher) --- |
|---|
| 89 | + |
|---|
| 90 | +final projectsProvider = StateProvider<List<Project>>((ref) => []); |
|---|
| 91 | + |
|---|
| 86 | 92 | // --- Messages --- |
|---|
| 87 | 93 | |
|---|
| 88 | | -final messagesProvider = |
|---|
| 89 | | - StateNotifierProvider<MessagesNotifier, List<Message>>((ref) { |
|---|
| 90 | | - return MessagesNotifier(ref); |
|---|
| 91 | | -}); |
|---|
| 94 | +final messagesProvider = StateNotifierProvider<MessagesNotifier, List<Message>>( |
|---|
| 95 | + (ref) { |
|---|
| 96 | + return MessagesNotifier(ref); |
|---|
| 97 | + }, |
|---|
| 98 | +); |
|---|
| 92 | 99 | |
|---|
| 93 | 100 | class MessagesNotifier extends StateNotifier<List<Message>> { |
|---|
| 94 | 101 | MessagesNotifier(this.ref) : super([]); |
|---|
| .. | .. |
|---|
| 103 | 110 | void switchSession(String sessionId) { |
|---|
| 104 | 111 | if (_currentSessionId == sessionId) { |
|---|
| 105 | 112 | TraceService.instance.addTrace( |
|---|
| 106 | | - 'switchSession SKIP', 'already on ${sessionId.substring(0, 8)}'); |
|---|
| 113 | + 'switchSession SKIP', |
|---|
| 114 | + 'already on ${sessionId.substring(0, 8)}', |
|---|
| 115 | + ); |
|---|
| 107 | 116 | return; |
|---|
| 108 | 117 | } |
|---|
| 109 | 118 | TraceService.instance.addTrace( |
|---|
| .. | .. |
|---|
| 173 | 182 | |
|---|
| 174 | 183 | // --- Unread Counts --- |
|---|
| 175 | 184 | |
|---|
| 176 | | -final unreadCountsProvider = |
|---|
| 177 | | - StateProvider<Map<String, int>>((ref) => {}); |
|---|
| 185 | +final unreadCountsProvider = StateProvider<Map<String, int>>((ref) => {}); |
|---|
| 178 | 186 | |
|---|
| 179 | 187 | // --- Input Mode --- |
|---|
| 180 | 188 | |
|---|
| .. | .. |
|---|
| 187 | 195 | // Holds the bridge between NavigateScreen and ChatScreen's MQTT service. |
|---|
| 188 | 196 | // ChatScreen sets this when MQTT is initialized; NavigateScreen reads it. |
|---|
| 189 | 197 | // Using a Riverpod provider eliminates the stale static reference risk. |
|---|
| 190 | | -final navigateNotifierProvider = StateProvider<NavigateNotifier?>((ref) => null); |
|---|
| 198 | +final navigateNotifierProvider = StateProvider<NavigateNotifier?>( |
|---|
| 199 | + (ref) => null, |
|---|
| 200 | +); |
|---|
| 191 | 201 | |
|---|
| 192 | 202 | // --- Pro / Purchase Status --- |
|---|
| 193 | 203 | |
|---|