一键导入
retries-offline-queuing
SourceLists can be configured to store failed Operations for later retry if a `RetryPolicy` is supplied.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
SourceLists can be configured to store failed Operations for later retry if a `RetryPolicy` is supplied.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Understand how sources declare operation capabilities via supportedOperations and how SourceList respects them.
FirestoreAdminSource connects google_cloud_firestore for server-side Dart applications to a SourceList.
FirestoreSource seamlessly connects Cloud Firestore streams to a SourceList.
Perform untyped Firestore document merges using the raw method on Firestore sources.
Cached data is mapped uniquely per request hash (RequestDetails with specific filter and pagination), supporting a powerful request-based caching behavior.
The SourceList class manages the delegation of read/write attempts to various configured Sources, with a read-thru cache system prioritizing local Sources.
| name | retries-offline-queuing |
| description | SourceLists can be configured to store failed Operations for later retry if a `RetryPolicy` is supplied. |
| metadata | {"last_modified":"Sat, 18 Apr 2026 1:52:50 GMT"} |
SourceLists can be configured to store failed Operations for later retry if a RetryPolicy is supplied.
final retryPolicy = DefaultRetryPolicy(
readsPersistence: InMemoryOperationPersistence(),
writesPersistence: HiveOperationPersistence(),
maxRetries: 3,
);
final sourceList = SourceList<MyObject>(
sources: <Source<MyObject>>[...],
retryPolicy: retryPolicy,
);
You can define a RetryPolicy to make any retry decisions you wish; but the following rules are captured in DefaultRetryPolicy:
400 Bad Request), are not retried as there is no reason to believe a subsequent attempt will fare any better.503 Service Unavailable) are scheduled to be retried via exponential backoff, up to maxRetries attempts.SourceList.connectivityService, of which one is available in the pkg:data_layer_flutter package.Retries are made up until maxRetries is reached for a given Operation. For operations that are critical, simply set maxRetries to null and pkg:data_layer will hold on to those Operations indefinitely, continuously trying to write them to the server until success is achieved. If retrying a critical Operation indefinitely, consider setting a maxWait time on the RetryPolicy to avoid unbounded delays. Something like 5 minutes should be suitable for most scenarios to continuously retry without hammering your server.
The default RetryPolicy object, as captured in DefaultRetryPolicy, will hold on to read requests in memory, retrying the requests as appropriate. This decision is based on the assumption that, once a user closes and re-opens your app, any desired reads will naturally be attempted again without requiring memory of failed reads during previous application launches. If this assumption is not suitable for your application, you should use a durable persistence provider for reads, instead.
The default RetryPolicy object, as captured in DefaultRetryPolicy, persists failed write operations in a durable storage provider (out of pkg:data_layer_hive) for long-lived retry attempts.
Retrying writes can turn destructive when updating existing records. For example, imagine a full-record UPDATE which only intends to modify 1 column but, while sitting in retry purgatory, contains stale values which could overwrite other updates which happen in the meanwhile.
To avoid this problem, consider using a MessageRepository and DTOs to keep writes as targeted as possible.