list method

Future<WebfontList> list({
  1. List<String>? capability,
  2. List<String>? family,
  3. String? sort,
  4. String? subset,
  5. String? $fields,
})

Retrieves the list of fonts currently served by the Google Fonts Developer API.

Request parameters:

capability - Controls the font urls in Webfont.files, by default, static ttf fonts are sent.

family - Filters by Webfont.family, using literal match. If not set, returns all families

sort - Enables sorting of the list. Possible string values are:

  • "SORT_UNDEFINED" : No sorting specified, use the default sorting method.
  • "ALPHA" : Sort alphabetically
  • "DATE" : Sort by date added
  • "POPULARITY" : Sort by popularity
  • "STYLE" : Sort by number of styles
  • "TRENDING" : Sort by trending

subset - Filters by Webfont.subset, if subset is found in Webfont.subsets. If not set, returns all families.

$fields - Selector specifying which fields to include in a partial response.

Completes with a WebfontList.

Completes with a commons.ApiRequestError if the API endpoint returned an error.

If the used http.Client completes with an error when making a REST call, this method will complete with the same error.

Implementation

async.Future<WebfontList> list({
  core.List<core.String>? capability,
  core.List<core.String>? family,
  core.String? sort,
  core.String? subset,
  core.String? $fields,
}) async {
  final queryParams_ = <core.String, core.List<core.String>>{
    if (capability != null) 'capability': capability,
    if (family != null) 'family': family,
    if (sort != null) 'sort': [sort],
    if (subset != null) 'subset': [subset],
    if ($fields != null) 'fields': [$fields],
  };

  const url_ = 'v1/webfonts';

  final response_ = await _requester.request(
    url_,
    'GET',
    queryParams: queryParams_,
  );
  return WebfontList.fromJson(
      response_ as core.Map<core.String, core.dynamic>);
}