HandoffBuffer.fromAddresses constructor

HandoffBuffer.fromAddresses({
  1. required int slotBytes,
  2. required int controlAddress,
  3. required List<int> slotAddresses,
})

Rebuilds a view over a buffer the other isolate allocated. The reconstructing side gets the same native memory at the same addresses - see Game's notes on what survives Isolate.spawn.

Implementation

HandoffBuffer.fromAddresses({
  required this.slotBytes,
  required int controlAddress,
  required List<int> slotAddresses,
}) : _control = Pointer<Int32>.fromAddress(controlAddress),
     _slots = <Pointer<Uint8>>[
       for (final address in slotAddresses)
         Pointer<Uint8>.fromAddress(address),
     ];