Skip to content

Commit 70cc9dd

Browse files
Demo: note why closure is not used for run async (#19)
1 parent 73812ab commit 70cc9dd

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

objectbox/example/flutter/objectbox_demo/lib/objectbox.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ class ObjectBox {
5656
Future<void> addNote(String text) =>
5757
store.runInTransactionAsync(TxMode.write, _addNoteInTx, text);
5858

59+
/// Note: due to [dart-lang/sdk#36983](https://github.com/dart-lang/sdk/issues/36983)
60+
/// not using a closure as it may capture more objects than expected.
61+
/// These might not be send-able to an isolate. See Store.runAsync for details.
5962
static void _addNoteInTx(Store store, String text) {
6063
// Perform ObjectBox operations that take longer than a few milliseconds
6164
// here. To keep it simple, this example just puts a single object.

objectbox/example/flutter/objectbox_demo_sync/lib/objectbox.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ class ObjectBox {
5353
Future<void> addNote(String text) =>
5454
store.runInTransactionAsync(TxMode.write, _addNoteInTx, text);
5555

56+
/// Note: due to [dart-lang/sdk#36983](https://github.com/dart-lang/sdk/issues/36983)
57+
/// not using a closure as it may capture more objects than expected.
58+
/// These might not be send-able to an isolate. See Store.runAsync for details.
5659
static void _addNoteInTx(Store store, String text) {
5760
// Perform ObjectBox operations that take longer than a few milliseconds
5861
// here. To keep it simple, this example just puts a single object.

0 commit comments

Comments
 (0)