available method

Future<List<ModelInfo>> available()

All available models from the C++ registry.

Runs one-shot filesystem discovery on first call. Dart registration writes generated ModelInfo bytes into commons; this list does not maintain a parallel Dart registry.

Implementation

Future<List<ModelInfo>> available() async {
  if (!DartBridge.isInitialized) {
    throw SDKException.notInitialized();
  }

  // Wait for Phase-2 downloaded-model discovery (best-effort; offline
  // listing of already-registered models must keep working).
  try {
    await DartBridge.ensureServicesReady();
  } catch (_) {
    // Non-fatal: registry contents remain listable.
  }

  final cppModels = await DartBridgeModelRegistry.instance
      .getAllProtoModels();
  return List.unmodifiable(cppModels);
}