rewriteQueuePayload method

  1. @override
Future<void> rewriteQueuePayload(
  1. String entryId,
  2. Map<String, dynamic> payload
)
override

Replaces the payload of the queue entry entryId with payload. Other fields (retry_count, last_error, operation, created_at, next_retry_at, synced) are untouched. Throws StateError if no such entry exists. Atomic with transaction. Added in 0.2.0.

Implementation

@override
Future<void> rewriteQueuePayload(
  String entryId,
  Map<String, dynamic> payload,
) async {
  final i = _queue.indexWhere((e) => e.id == entryId);
  if (i < 0) throw StateError('Queue entry $entryId not found');
  _queue[i] = _queue[i].copyWith(payload: Map<String, dynamic>.from(payload));
}