backendTextToSpeechCapabilities property

Future<BackendTextToSpeechCapabilities> get backendTextToSpeechCapabilities

Returns backend-native text-to-speech capabilities for the loaded model.

This is the low-level integration hook used by TextToSpeechEngine. Applications should prefer that typed API instead of calling this method directly.

Implementation

Future<BackendTextToSpeechCapabilities>
get backendTextToSpeechCapabilities async {
  if (isDisposed) {
    return const BackendTextToSpeechCapabilities(
      isSupported: false,
      unsupportedReason: LlamaEngine._disposedMessage,
    );
  }
  if (!_isReady || _contextHandle == null || _mmContextHandle == null) {
    return const BackendTextToSpeechCapabilities(
      isSupported: false,
      unsupportedReason:
          'Load a model and its text-to-speech projector first.',
    );
  }
  final candidate = backend;
  if (candidate is! BackendTextToSpeech) {
    return const BackendTextToSpeechCapabilities(
      isSupported: false,
      unsupportedReason:
          'The active backend does not expose dedicated text-to-speech.',
    );
  }
  final textToSpeechBackend = candidate as BackendTextToSpeech;
  return textToSpeechBackend.textToSpeechCapabilities(
    _contextHandle!,
    _mmContextHandle!,
  );
}