lc0Async function

Future<Lc0> lc0Async({
  1. String? weightsPath,
})

Creates a C++ engine asynchronously.

weightsPath is the path to the neural network weights file (.pb.gz). This is required for lc0 to function properly.

This method is different from the factory method Lc0.new that it will wait for the engine to be ready before returning the instance.

Implementation

Future<Lc0> lc0Async({String? weightsPath}) {
  if (Lc0._instance != null) {
    return Future.error(StateError('Only one instance can be used at a time'));
  }

  final completer = Completer<Lc0>();
  Lc0._instance = Lc0._(completer: completer, weightsPath: weightsPath);
  return completer.future;
}