File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed
packages/powersync_core/lib/src/database Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -544,7 +544,26 @@ mixin PowerSyncDatabaseMixin implements SqliteConnection {
544544 /// stream until that point as completed.
545545 ///
546546 /// This can be used to upload multiple transactions in a single batch, e.g.
547- /// with:AbortController
547+ /// with:
548+ ///
549+ /// ```dart
550+ /// CrudTransaction? lastTransaction;
551+ /// final batch = <CrudEntry>[];
552+ ///
553+ /// await for (final transaction in powersync.nextCrudTransactions()) {
554+ /// batch.addAll(transaction.crud);
555+ /// lastTransaction = transaction;
556+ ///
557+ /// if (batch.length > 100) {
558+ /// break;
559+ /// }
560+ /// }
561+ ///
562+ /// if (batch.isNotEmpty) {
563+ /// await uploadBatch(batch);
564+ /// lastTransaction!.complete();
565+ /// }
566+ /// ```
548567 ///
549568 /// If there is no local data to upload, the stream emits a single `onDone`
550569 /// event.
You can’t perform that action at this time.
0 commit comments