persist method

Future<void> persist()

Persists current in-memory queue to storage.

Implementation

Future<void> persist() async {
  if (storage == null) return;
  try {
    final list = _queue.map((m) => m.toMap()).toList();
    await storage!.write(_storageKey, jsonEncode(list));
  } catch (e) {
    logger.error('OfflineMutationQueue: Failed to persist mutations to storage: $e');
  }
}