@@ -227,9 +227,12 @@ class Store {
227227 /// without any info like model definition, database directory and others.
228228 ///
229229 /// This store is e.g. good enough to start a transaction, but does not allow
230- /// to e.g. use boxes.
230+ /// to e.g. use boxes. This is useful when creating a store within another
231+ /// isolate as only information that can be sent to an isolate is necessary
232+ /// (the store and model definition contain pointers that can not be sent to
233+ /// an isolate).
231234 ///
232- /// Obtain a [ptrAddress] from [_clone] .
235+ /// Obtain a [ptrAddress] from [_clone] , see it for more details .
233236 Store ._minimal (int ptrAddress, {bool queriesCaseSensitiveDefault = true })
234237 : _defs = null ,
235238 _weak = false ,
@@ -360,7 +363,26 @@ class Store {
360363
361364 /// Clones this native store and returns a pointer to the clone.
362365 ///
363- /// Use the address of the pointer with [Store._minimal] .
366+ /// The address of the pointer can be used with [Store._minimal] .
367+ ///
368+ /// This can be useful to work with isolates as it is not possible to send a
369+ /// [Store] to an isolate (the Store itself and the contained model definition
370+ /// contain pointers). Instead, send the pointer address returned by this
371+ /// and create a minimal store (for limitations see [Store._minimal] ) in the
372+ /// isolate. Make sure to [close] the clone as well before the isolate exits.
373+ ///
374+ /// ```dart
375+ /// // Clone the store and obtain its address, can be sent to an isolate.
376+ /// final storePtrAddress = store.clone().address;
377+ ///
378+ /// // Within an isolate create a minimal store.
379+ /// final store = InternalStoreAccess.createMinimal(isolateInit.storePtrAddress);
380+ /// try {
381+ /// // Use the store.
382+ /// } finally {
383+ /// store.close();
384+ /// }
385+ /// ```
364386 Pointer <OBX_store > _clone () {
365387 final ptr = checkObxPtr (C .store_clone (_ptr));
366388 reachabilityFence (this );
0 commit comments