list method Null safety

Future<WebfontList> list(
  1. {String? sort,
  2. String? $fields}
)

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

Request parameters:

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

$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.String? sort,
  core.String? $fields,
}) async {
  final _queryParams = <core.String, core.List<core.String>>{
    if (sort != null) 'sort': [sort],
    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>);
}