models static method

Future<List> models()

Get the list of available models from the Pollinations API. @return A Future that resolves to a list of models.

Implementation

static Future<List<dynamic>> models() async {
  final response = await http
      .get(
        Uri.parse("https://${ApiConfig.getEndpoint(Api.image)}/models"),
        headers: ApiConfig.headers,
      )
      .timeout(Duration(seconds: ApiConfig.timeout));

  if (response.statusCode == 200) {
    return json.decode(response.body);
  }
  return [];
}