analyzeSentiment method

  1. @override
Future<AnalyzeSentimentResponse> analyzeSentiment(
  1. AnalyzeSentimentRequest request
)
override

Analyzes the sentiment of the provided text.

Throws a http.ClientException if there were problems communicating with the API service. Throws a ServiceException if the API method failed for any reason.

Implementation

@override
Future<AnalyzeSentimentResponse> analyzeSentiment(
  AnalyzeSentimentRequest request,
) async {
  if (isClosed) throw StateError('Service is closed');

  if (_analyzeSentiment case final analyzeSentiment?) {
    return analyzeSentiment(request);
  }
  throw UnsupportedError('analyzeSentiment');
}