listModels method

  1. @override
Future<ListModelsResponse> listModels(
  1. ListModelsRequest request
)
override

Lists the Models available through the Gemini API.

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<ListModelsResponse> listModels(ListModelsRequest request) async {
  if (isClosed) throw StateError('Service is closed');

  if (_listModels case final listModels?) {
    return listModels(request);
  }
  throw UnsupportedError('listModels');
}