---
source: boltffi_bindgen/src/render/dart/templates.rs
expression: template.render().unwrap()
---
@$$ffi.Native<
  $$ffi.Void Function($$ffi.Pointer<$$ffi.Void>)
>(symbol: 'boltffi_person_free', isLeaf: true)
external void _f$boltffi_person_free($$ffi.Pointer<$$ffi.Void> handle);

@$$ffi.Native<
  $$ffi.Pointer<$$ffi.Void> Function(
    $$ffi.Pointer<$$ffi.Uint8>,
    $$ffi.UintPtr,
    $$ffi.Uint32,
  )
>(symbol: 'boltffi_person_new', isLeaf: true)
external $$ffi.Pointer<$$ffi.Void> _f$boltffi_person_new(
  $$ffi.Pointer<$$ffi.Uint8> namePtr,
  int nameLen,
  int age,
);
@$$ffi.Native<
  $$ffi.Pointer<$$ffi.Void> Function(
    $$ffi.Pointer<$$ffi.Uint8>,
    $$ffi.UintPtr,
  )
>(symbol: 'boltffi_person_new_with_default_age', isLeaf: true)
external $$ffi.Pointer<$$ffi.Void> _f$boltffi_person_new_with_default_age(
  $$ffi.Pointer<$$ffi.Uint8> namePtr,
  int nameLen,
);

@$$ffi.Native<
  $$ffi.Pointer<$$ffi.Void> Function(
    $$ffi.Pointer<$$ffi.Void>,
    )
>(symbol: 'boltffi_person_temperature_event_async', isLeaf: true)
external $$ffi.Pointer<$$ffi.Void> _f$boltffi_person_temperature_event_async(
  $$ffi.Pointer<$$ffi.Void> handle,
);

@$$ffi.Native<
  $$ffi.Void Function(
    $$ffi.Pointer<$$ffi.Void>,
    $$ffi.Uint64,
    $$ffi.Pointer<$$ffi.NativeFunction<$$ffi.Void Function($$ffi.Uint64, $$ffi.Int8)>>,
    )
>(symbol: 'boltffi_person_temperature_event_async_poll')
external void _f$boltffi_person_temperature_event_async_poll(
  $$ffi.Pointer<$$ffi.Void> handle,
  int callback_data,
  $$ffi.Pointer<$$ffi.NativeFunction<$$ffi.Void Function($$ffi.Uint64, $$ffi.Int8)>> callback,
);

@$$ffi.Native<
  $$ffi.UintPtr Function(
    $$ffi.Pointer<$$ffi.Void>,
    $$ffi.Pointer<$$ffi.Float>,
    $$ffi.UintPtr,
    )
>(symbol: 'boltffi_person_temperature_event_async_pop_batch', isLeaf: true)
external int _f$boltffi_person_temperature_event_async_pop_batch(
  $$ffi.Pointer<$$ffi.Void> handle,
  $$ffi.Pointer<$$ffi.Float> output_ptr,
  int output_capacity,
);

@$$ffi.Native<
  $$ffi.Int32 Function(
    $$ffi.Pointer<$$ffi.Void>,
    $$ffi.Uint32,
    )
>(symbol: 'boltffi_person_temperature_event_async_wait', isLeaf: true)
external int _f$boltffi_person_temperature_event_async_wait(
  $$ffi.Pointer<$$ffi.Void> handle,
  int timeout_milliseconds,
);

@$$ffi.Native<
  $$ffi.Void Function(
    $$ffi.Pointer<$$ffi.Void>,
    )
>(symbol: 'boltffi_person_temperature_event_async_unsubscribe')
external void _f$boltffi_person_temperature_event_async_unsubscribe(
  $$ffi.Pointer<$$ffi.Void> handle,
);

@$$ffi.Native<
  $$ffi.Void Function(
    $$ffi.Pointer<$$ffi.Void>,
    )
>(symbol: 'boltffi_person_temperature_event_async_free')
external void _f$boltffi_person_temperature_event_async_free(
  $$ffi.Pointer<$$ffi.Void> handle,
);

@$$ffi.Native<
  $$ffi.Pointer<$$ffi.Void> Function(
    $$ffi.Pointer<$$ffi.Void>,
    )
>(symbol: 'boltffi_person_temperature_event_batch', isLeaf: true)
external $$ffi.Pointer<$$ffi.Void> _f$boltffi_person_temperature_event_batch(
  $$ffi.Pointer<$$ffi.Void> handle,
);

@$$ffi.Native<
  $$ffi.Void Function(
    $$ffi.Pointer<$$ffi.Void>,
    $$ffi.Uint64,
    $$ffi.Pointer<$$ffi.NativeFunction<$$ffi.Void Function($$ffi.Uint64, $$ffi.Int8)>>,
    )
>(symbol: 'boltffi_person_temperature_event_batch_poll')
external void _f$boltffi_person_temperature_event_batch_poll(
  $$ffi.Pointer<$$ffi.Void> handle,
  int callback_data,
  $$ffi.Pointer<$$ffi.NativeFunction<$$ffi.Void Function($$ffi.Uint64, $$ffi.Int8)>> callback,
);

@$$ffi.Native<
  $$ffi.UintPtr Function(
    $$ffi.Pointer<$$ffi.Void>,
    $$ffi.Pointer<$$ffi.Float>,
    $$ffi.UintPtr,
    )
>(symbol: 'boltffi_person_temperature_event_batch_pop_batch', isLeaf: true)
external int _f$boltffi_person_temperature_event_batch_pop_batch(
  $$ffi.Pointer<$$ffi.Void> handle,
  $$ffi.Pointer<$$ffi.Float> output_ptr,
  int output_capacity,
);

@$$ffi.Native<
  $$ffi.Int32 Function(
    $$ffi.Pointer<$$ffi.Void>,
    $$ffi.Uint32,
    )
>(symbol: 'boltffi_person_temperature_event_batch_wait', isLeaf: true)
external int _f$boltffi_person_temperature_event_batch_wait(
  $$ffi.Pointer<$$ffi.Void> handle,
  int timeout_milliseconds,
);

@$$ffi.Native<
  $$ffi.Void Function(
    $$ffi.Pointer<$$ffi.Void>,
    )
>(symbol: 'boltffi_person_temperature_event_batch_unsubscribe')
external void _f$boltffi_person_temperature_event_batch_unsubscribe(
  $$ffi.Pointer<$$ffi.Void> handle,
);

@$$ffi.Native<
  $$ffi.Void Function(
    $$ffi.Pointer<$$ffi.Void>,
    )
>(symbol: 'boltffi_person_temperature_event_batch_free')
external void _f$boltffi_person_temperature_event_batch_free(
  $$ffi.Pointer<$$ffi.Void> handle,
);

@$$ffi.Native<
  $$ffi.Pointer<$$ffi.Void> Function(
    $$ffi.Pointer<$$ffi.Void>,
    )
>(symbol: 'boltffi_person_temperature_event_callback', isLeaf: true)
external $$ffi.Pointer<$$ffi.Void> _f$boltffi_person_temperature_event_callback(
  $$ffi.Pointer<$$ffi.Void> handle,
);

@$$ffi.Native<
  $$ffi.Void Function(
    $$ffi.Pointer<$$ffi.Void>,
    $$ffi.Uint64,
    $$ffi.Pointer<$$ffi.NativeFunction<$$ffi.Void Function($$ffi.Uint64, $$ffi.Int8)>>,
    )
>(symbol: 'boltffi_person_temperature_event_callback_poll')
external void _f$boltffi_person_temperature_event_callback_poll(
  $$ffi.Pointer<$$ffi.Void> handle,
  int callback_data,
  $$ffi.Pointer<$$ffi.NativeFunction<$$ffi.Void Function($$ffi.Uint64, $$ffi.Int8)>> callback,
);

@$$ffi.Native<
  $$ffi.UintPtr Function(
    $$ffi.Pointer<$$ffi.Void>,
    $$ffi.Pointer<$$ffi.Float>,
    $$ffi.UintPtr,
    )
>(symbol: 'boltffi_person_temperature_event_callback_pop_batch', isLeaf: true)
external int _f$boltffi_person_temperature_event_callback_pop_batch(
  $$ffi.Pointer<$$ffi.Void> handle,
  $$ffi.Pointer<$$ffi.Float> output_ptr,
  int output_capacity,
);

@$$ffi.Native<
  $$ffi.Int32 Function(
    $$ffi.Pointer<$$ffi.Void>,
    $$ffi.Uint32,
    )
>(symbol: 'boltffi_person_temperature_event_callback_wait', isLeaf: true)
external int _f$boltffi_person_temperature_event_callback_wait(
  $$ffi.Pointer<$$ffi.Void> handle,
  int timeout_milliseconds,
);

@$$ffi.Native<
  $$ffi.Void Function(
    $$ffi.Pointer<$$ffi.Void>,
    )
>(symbol: 'boltffi_person_temperature_event_callback_unsubscribe')
external void _f$boltffi_person_temperature_event_callback_unsubscribe(
  $$ffi.Pointer<$$ffi.Void> handle,
);

@$$ffi.Native<
  $$ffi.Void Function(
    $$ffi.Pointer<$$ffi.Void>,
    )
>(symbol: 'boltffi_person_temperature_event_callback_free')
external void _f$boltffi_person_temperature_event_callback_free(
  $$ffi.Pointer<$$ffi.Void> handle,
);

@$$ffi.Native<
  $$ffi.Pointer<$$ffi.Void> Function(
    $$ffi.Pointer<$$ffi.Void>,
    )
>(symbol: 'boltffi_person_names_event_async', isLeaf: true)
external $$ffi.Pointer<$$ffi.Void> _f$boltffi_person_names_event_async(
  $$ffi.Pointer<$$ffi.Void> handle,
);

@$$ffi.Native<
  $$ffi.Void Function(
    $$ffi.Pointer<$$ffi.Void>,
    $$ffi.Uint64,
    $$ffi.Pointer<$$ffi.NativeFunction<$$ffi.Void Function($$ffi.Uint64, $$ffi.Int8)>>,
    )
>(symbol: 'boltffi_person_names_event_async_poll')
external void _f$boltffi_person_names_event_async_poll(
  $$ffi.Pointer<$$ffi.Void> handle,
  int callback_data,
  $$ffi.Pointer<$$ffi.NativeFunction<$$ffi.Void Function($$ffi.Uint64, $$ffi.Int8)>> callback,
);

@$$ffi.Native<
  _$$FFIBuf Function(
    $$ffi.Pointer<$$ffi.Void>,
    $$ffi.UintPtr,
    )
>(symbol: 'boltffi_person_names_event_async_pop_batch', isLeaf: true)
external _$$FFIBuf _f$boltffi_person_names_event_async_pop_batch(
  $$ffi.Pointer<$$ffi.Void> handle,
  int max_count,
);

@$$ffi.Native<
  $$ffi.Int32 Function(
    $$ffi.Pointer<$$ffi.Void>,
    $$ffi.Uint32,
    )
>(symbol: 'boltffi_person_names_event_async_wait', isLeaf: true)
external int _f$boltffi_person_names_event_async_wait(
  $$ffi.Pointer<$$ffi.Void> handle,
  int timeout_milliseconds,
);

@$$ffi.Native<
  $$ffi.Void Function(
    $$ffi.Pointer<$$ffi.Void>,
    )
>(symbol: 'boltffi_person_names_event_async_unsubscribe')
external void _f$boltffi_person_names_event_async_unsubscribe(
  $$ffi.Pointer<$$ffi.Void> handle,
);

@$$ffi.Native<
  $$ffi.Void Function(
    $$ffi.Pointer<$$ffi.Void>,
    )
>(symbol: 'boltffi_person_names_event_async_free')
external void _f$boltffi_person_names_event_async_free(
  $$ffi.Pointer<$$ffi.Void> handle,
);

@$$ffi.Native<
  $$ffi.Pointer<$$ffi.Void> Function(
    $$ffi.Pointer<$$ffi.Void>,
    )
>(symbol: 'boltffi_person_names_event_batch', isLeaf: true)
external $$ffi.Pointer<$$ffi.Void> _f$boltffi_person_names_event_batch(
  $$ffi.Pointer<$$ffi.Void> handle,
);

@$$ffi.Native<
  $$ffi.Void Function(
    $$ffi.Pointer<$$ffi.Void>,
    $$ffi.Uint64,
    $$ffi.Pointer<$$ffi.NativeFunction<$$ffi.Void Function($$ffi.Uint64, $$ffi.Int8)>>,
    )
>(symbol: 'boltffi_person_names_event_batch_poll')
external void _f$boltffi_person_names_event_batch_poll(
  $$ffi.Pointer<$$ffi.Void> handle,
  int callback_data,
  $$ffi.Pointer<$$ffi.NativeFunction<$$ffi.Void Function($$ffi.Uint64, $$ffi.Int8)>> callback,
);

@$$ffi.Native<
  _$$FFIBuf Function(
    $$ffi.Pointer<$$ffi.Void>,
    $$ffi.UintPtr,
    )
>(symbol: 'boltffi_person_names_event_batch_pop_batch', isLeaf: true)
external _$$FFIBuf _f$boltffi_person_names_event_batch_pop_batch(
  $$ffi.Pointer<$$ffi.Void> handle,
  int max_count,
);

@$$ffi.Native<
  $$ffi.Int32 Function(
    $$ffi.Pointer<$$ffi.Void>,
    $$ffi.Uint32,
    )
>(symbol: 'boltffi_person_names_event_batch_wait', isLeaf: true)
external int _f$boltffi_person_names_event_batch_wait(
  $$ffi.Pointer<$$ffi.Void> handle,
  int timeout_milliseconds,
);

@$$ffi.Native<
  $$ffi.Void Function(
    $$ffi.Pointer<$$ffi.Void>,
    )
>(symbol: 'boltffi_person_names_event_batch_unsubscribe')
external void _f$boltffi_person_names_event_batch_unsubscribe(
  $$ffi.Pointer<$$ffi.Void> handle,
);

@$$ffi.Native<
  $$ffi.Void Function(
    $$ffi.Pointer<$$ffi.Void>,
    )
>(symbol: 'boltffi_person_names_event_batch_free')
external void _f$boltffi_person_names_event_batch_free(
  $$ffi.Pointer<$$ffi.Void> handle,
);

@$$ffi.Native<
  $$ffi.Pointer<$$ffi.Void> Function(
    $$ffi.Pointer<$$ffi.Void>,
    )
>(symbol: 'boltffi_person_names_event_callback', isLeaf: true)
external $$ffi.Pointer<$$ffi.Void> _f$boltffi_person_names_event_callback(
  $$ffi.Pointer<$$ffi.Void> handle,
);

@$$ffi.Native<
  $$ffi.Void Function(
    $$ffi.Pointer<$$ffi.Void>,
    $$ffi.Uint64,
    $$ffi.Pointer<$$ffi.NativeFunction<$$ffi.Void Function($$ffi.Uint64, $$ffi.Int8)>>,
    )
>(symbol: 'boltffi_person_names_event_callback_poll')
external void _f$boltffi_person_names_event_callback_poll(
  $$ffi.Pointer<$$ffi.Void> handle,
  int callback_data,
  $$ffi.Pointer<$$ffi.NativeFunction<$$ffi.Void Function($$ffi.Uint64, $$ffi.Int8)>> callback,
);

@$$ffi.Native<
  _$$FFIBuf Function(
    $$ffi.Pointer<$$ffi.Void>,
    $$ffi.UintPtr,
    )
>(symbol: 'boltffi_person_names_event_callback_pop_batch', isLeaf: true)
external _$$FFIBuf _f$boltffi_person_names_event_callback_pop_batch(
  $$ffi.Pointer<$$ffi.Void> handle,
  int max_count,
);

@$$ffi.Native<
  $$ffi.Int32 Function(
    $$ffi.Pointer<$$ffi.Void>,
    $$ffi.Uint32,
    )
>(symbol: 'boltffi_person_names_event_callback_wait', isLeaf: true)
external int _f$boltffi_person_names_event_callback_wait(
  $$ffi.Pointer<$$ffi.Void> handle,
  int timeout_milliseconds,
);

@$$ffi.Native<
  $$ffi.Void Function(
    $$ffi.Pointer<$$ffi.Void>,
    )
>(symbol: 'boltffi_person_names_event_callback_unsubscribe')
external void _f$boltffi_person_names_event_callback_unsubscribe(
  $$ffi.Pointer<$$ffi.Void> handle,
);

@$$ffi.Native<
  $$ffi.Void Function(
    $$ffi.Pointer<$$ffi.Void>,
    )
>(symbol: 'boltffi_person_names_event_callback_free')
external void _f$boltffi_person_names_event_callback_free(
  $$ffi.Pointer<$$ffi.Void> handle,
);
final class Person implements $$ffi.Finalizable {
  static final _finalizer = $$ffi.NativeFinalizer(
    $$ffi.Native.addressOf(_f$boltffi_person_free)
  );

  final $$ffi.Pointer<$$ffi.Void> _handle;

  Person._(this._handle) {
    _finalizer.attach(this, _handle, detach: this);
  }

  factory Person(
    String name,
    int age,
  ) {}

  factory Person.newWithDefaultAge(
    String name,
  ) {}

  String getName(
  ) {}

  Stream<double> temperatureEventAsync() {
    final ctx = _$$BoltFFIStreamCtx(
      subscribe: () => _f$boltffi_person_temperature_event_async(_handle),
      pollFn: _f$boltffi_person_temperature_event_async_poll,
      waitFn: _f$boltffi_person_temperature_event_async_wait,
      unsubscribeFn: _f$boltffi_person_temperature_event_async_unsubscribe,
      freeFn: _f$boltffi_person_temperature_event_async_free,
      itemSize: 4

    );

    return ctx.stream((handle, batchSize, itemSize, controller) {
      final l$buf = $$typed_data.Uint8List(batchSize * itemSize!);
      final l$count = _f$boltffi_person_temperature_event_async_pop_batch(handle, l$buf.address.cast(), batchSize);
      if (l$count == 0) {
        return;
      }
      final List<double> l$items = [];

      controller.addStream(Stream.fromIterable(l$items));
    });
  }

  $$BoltFFIStreamPopBatchHandle<double> temperatureEventBatch() {
    final ctx = _$$BoltFFIStreamCtx(
      subscribe: () => _f$boltffi_person_temperature_event_batch(_handle),
      pollFn: _f$boltffi_person_temperature_event_batch_poll,
      waitFn: _f$boltffi_person_temperature_event_batch_wait,
      unsubscribeFn: _f$boltffi_person_temperature_event_batch_unsubscribe,
      freeFn: _f$boltffi_person_temperature_event_batch_free,
      itemSize: 4

    );

    return ctx.batch((handle, batchSize, itemSize) {
      final l$buf = $$typed_data.Uint8List(batchSize * itemSize!);
      final l$count = _f$boltffi_person_temperature_event_batch_pop_batch(handle, l$buf.address.cast(), batchSize);
      if (l$count == 0) {
        return [];
      }
      final List<double> l$items = [];

      return l$items;
    });
  }

  $$async.StreamSubscription<double> temperatureEventCallback(void Function(double) cb) {
    final ctx = _$$BoltFFIStreamCtx(
      subscribe: () => _f$boltffi_person_temperature_event_callback(_handle),
      pollFn: _f$boltffi_person_temperature_event_callback_poll,
      waitFn: _f$boltffi_person_temperature_event_callback_wait,
      unsubscribeFn: _f$boltffi_person_temperature_event_callback_unsubscribe,
      freeFn: _f$boltffi_person_temperature_event_callback_free,
      itemSize: 4

    );

    final Stream<double> stream = ctx.stream((handle, batchSize, itemSize, controller) {
      final l$buf = $$typed_data.Uint8List(batchSize * itemSize!);
      final l$count = _f$boltffi_person_temperature_event_callback_pop_batch(handle, l$buf.address.cast(), batchSize);
      if (l$count == 0) {
        return;
      }
      final List<double> l$items = [];

      controller.addStream(Stream.fromIterable(l$items));
    });

    return stream.listen(cb);
  }

  Stream<String> namesEventAsync() {
    final ctx = _$$BoltFFIStreamCtx(
      subscribe: () => _f$boltffi_person_names_event_async(_handle),
      pollFn: _f$boltffi_person_names_event_async_poll,
      waitFn: _f$boltffi_person_names_event_async_wait,
      unsubscribeFn: _f$boltffi_person_names_event_async_unsubscribe,
      freeFn: _f$boltffi_person_names_event_async_free,
    );

    return ctx.stream((handle, batchSize, itemSize, controller) {
      final l$buf = _f$boltffi_person_names_event_async_pop_batch(handle, batchSize);
      if (l$buf.len == 0) {
        return;
      }
      final l$bufReader = _$$WireReader(l$buf.ptr, l$buf.len);
      final List<String> l$items = l$bufReader.readList((l$bufReader) => l$bufReader.readString());
      if (l$items.isEmpty) {
        return;
      }
      _f$boltffi_free_buf(l$buf);
      controller.addStream(Stream.fromIterable(l$items));
    });
  }

  $$BoltFFIStreamPopBatchHandle<String> namesEventBatch() {
    final ctx = _$$BoltFFIStreamCtx(
      subscribe: () => _f$boltffi_person_names_event_batch(_handle),
      pollFn: _f$boltffi_person_names_event_batch_poll,
      waitFn: _f$boltffi_person_names_event_batch_wait,
      unsubscribeFn: _f$boltffi_person_names_event_batch_unsubscribe,
      freeFn: _f$boltffi_person_names_event_batch_free,
    );

    return ctx.batch((handle, batchSize, itemSize) {
      final l$buf = _f$boltffi_person_names_event_batch_pop_batch(handle, batchSize);
      if (l$buf.len == 0) {
        return;
      }
      final l$bufReader = _$$WireReader(l$buf.ptr, l$buf.len);
      final List<String> l$items = l$bufReader.readList((l$bufReader) => l$bufReader.readString());
      if (l$items.isEmpty) {
        return [];
      }
      _f$boltffi_free_buf(l$buf);
      return l$items;
    });
  }

  $$async.StreamSubscription<String> namesEventCallback(void Function(String) cb) {
    final ctx = _$$BoltFFIStreamCtx(
      subscribe: () => _f$boltffi_person_names_event_callback(_handle),
      pollFn: _f$boltffi_person_names_event_callback_poll,
      waitFn: _f$boltffi_person_names_event_callback_wait,
      unsubscribeFn: _f$boltffi_person_names_event_callback_unsubscribe,
      freeFn: _f$boltffi_person_names_event_callback_free,
    );

    final Stream<String> stream = ctx.stream((handle, batchSize, itemSize, controller) {
      final l$buf = _f$boltffi_person_names_event_callback_pop_batch(handle, batchSize);
      if (l$buf.len == 0) {
        return;
      }
      final l$bufReader = _$$WireReader(l$buf.ptr, l$buf.len);
      final List<String> l$items = l$bufReader.readList((l$bufReader) => l$bufReader.readString());
      if (l$items.isEmpty) {
        return;
      }
      _f$boltffi_free_buf(l$buf);
      controller.addStream(Stream.fromIterable(l$items));
    });

    return stream.listen(cb);
  }
}
