setActiveModel method

Future<void> setActiveModel(
  1. String modelId
)

Mark modelId as the active local model. Disposes any previously loaded engine when the active model changes.

Implementation

Future<void> setActiveModel(String modelId) async {
  if (!_modelSpecs.containsKey(modelId)) {
    throw StateError('Unknown local model: "$modelId".');
  }
  if (_activeModelId == modelId) return;
  await dispose();
  _activeModelId = modelId;
}