restore method
Restores persisted mutations from disk storage.
Example:
await queue.restore();
Implementation
Future<void> restore() async {
if (storage == null) return;
try {
final raw = await storage!.read(_storageKey);
if (raw != null && raw.isNotEmpty) {
final list = jsonDecode(raw) as List;
_queue.clear();
for (final item in list) {
_queue.add(QueuedMutation.fromMap(Map<String, dynamic>.from(item as Map)));
}
logger.info('OfflineMutationQueue: Restored ${_queue.length} mutations from persistent storage.');
}
} catch (e) {
logger.error('OfflineMutationQueue: Failed to restore mutations from storage: $e');
}
}