textToSpeechCapabilitiesForPlatform function

TaskCapabilities textToSpeechCapabilitiesForPlatform(
  1. TaskPlatform platform
)

Text to Speech support on platform, without loading code.

Implementation

TaskCapabilities textToSpeechCapabilitiesForPlatform(TaskPlatform platform) {
  final targets = _speechTargets();
  return TaskCapabilities.onTargets(
    platform: platform,
    delegates: {Delegate.cpu: targets, Delegate.gpu: textToSpeechGpuTargets},
    unavailableReasons: {
      Delegate.cpu: _speechUnavailable(platform),
      Delegate.gpu: !targets.containsKey(platform.target)
          ? _speechUnavailable(platform)
          : platform.operatingSystem == 'web'
          ? _textToSpeechWebGpuUnproved
          : _textToSpeechGpuUnproved,
    },
    runtimeVersion: tasksRuntimeVersionOn(platform),
  );
}