Buffer.fromStreamParams constructor

Buffer.fromStreamParams(
  1. Synthizer synthizer,
  2. String protocol,
  3. String path, {
  4. String options = '',
})

Create a buffer from stream parameters.

Implementation

factory Buffer.fromStreamParams(
  final Synthizer synthizer,
  final String protocol,
  final String path, {
  final String options = '',
}) {
  final protocolPointer = protocol.toNativeUtf8().cast<Char>();
  final pathPointer = path.toNativeUtf8().cast<Char>();
  final optionsPointer = options.toNativeUtf8().cast<Void>();
  synthizer.check(
    synthizer.synthizer.syz_createBufferFromStreamParams(
      synthizer.bigIntPointer,
      protocolPointer,
      pathPointer,
      optionsPointer,
      nullptr,
      synthizer.userdataFreeCallbackPointer,
    ),
  );
  [
    protocolPointer,
    pathPointer,
    optionsPointer,
  ].forEach(malloc.free);
  return Buffer(synthizer, handle: synthizer.bigIntPointer.value);
}