@@ -49,20 +49,24 @@ void main() {
49
49
/// Work with a single store across multiple isolates using
50
50
/// the legacy way of passing a pointer reference to the isolate.
51
51
test ('single store using reference' , () async {
52
- final storeCreator = (dynamic msg) =>
53
- Store .fromReference (getObjectBoxModel (), msg as ByteData );
54
- await testUsingStoreFromIsolate (storeCreator, (env) => env.store.reference);
52
+ await testUsingStoreFromIsolate (
53
+ storeCreatorFromRef, (env) => env.store.reference);
55
54
});
56
55
57
56
/// Work with a single store across multiple isolates using
58
57
/// the directory path to attach to an existing store.
59
58
test ('single store using attach' , () async {
60
- final storeCreator =
61
- (dynamic msg) => Store .attach (getObjectBoxModel (), msg as String );
62
- await testUsingStoreFromIsolate (storeCreator, (env) => env.dir.path);
59
+ await testUsingStoreFromIsolate (storeCreatorAttach, (env) => env.dir.path);
63
60
});
64
61
}
65
62
63
+ // Note: can't use closures, are only supported from Dart SDK 2.15.
64
+ Store storeCreatorFromRef (dynamic msg) =>
65
+ Store .fromReference (getObjectBoxModel (), msg as ByteData );
66
+
67
+ Store storeCreatorAttach (dynamic msg) =>
68
+ Store .attach (getObjectBoxModel (), msg as String );
69
+
66
70
class IsolateInitMessage {
67
71
SendPort sendPort;
68
72
Store Function (dynamic ) storeCreator;
0 commit comments