Synthizer constructor Null safety

Synthizer(
  1. {String? filename}
)

Create an instance.

Implementation

Synthizer({String? filename})
    : _eventPointer = calloc<syz_Event>(),
      intPointer = calloc<Int32>(),
      bigIntPointer = calloc<Uint64>(),
      majorPointer = calloc<Uint32>(),
      minorPointer = calloc<Uint32>(),
      patchPointer = calloc<Uint32>(),
      routeConfig = calloc<syz_RouteConfig>(),
      doublePointer = calloc<Double>(),
      x1 = calloc<Double>(),
      y1 = calloc<Double>(),
      z1 = calloc<Double>(),
      x2 = calloc<Double>(),
      y2 = calloc<Double>(),
      z2 = calloc<Double>(),
      userdataFreeCallbackPointer = nullptr.cast<syz_UserdataFreeCallback>(),
      deleteBehaviorConfigPointer = calloc<syz_DeleteBehaviorConfig>(),
      sineBankWavePointer = calloc<syz_SineBankWave>(),
      sineBankConfigPointer = calloc<syz_SineBankConfig>(),
      _wasInit = false {
  final DynamicLibrary library;
  if (filename == null) {
    if (Platform.isWindows) {
      library = DynamicLibrary.open('synthizer.dll');
    } else if (Platform.isLinux) {
      library = DynamicLibrary.open('libsynthizer.so');
    } else {
      throw SynthizerError('Unhandled platform.', -1);
    }
  } else if (filename == synthizerExecutableFilename) {
    library = DynamicLibrary.executable();
  } else if (filename == synthizerProcessFilename) {
    library = DynamicLibrary.process();
  } else {
    library = DynamicLibrary.open(filename);
  }
  synthizer = DartSynthizer(library);
}