pub_api_client 1.0.0 copy "pub_api_client: ^1.0.0" to clipboard
pub_api_client: ^1.0.0 copied to clipboard

outdated

A starting point for Dart libraries or applications.

drawing

An unofficial API client for Pub.dev #

Implements all known endpoints available on pub.dev. If any particular endpoint is missing please open an issue.

Usage #

A simple usage example:

import 'package:pub_api_client/pub_api_client.dart';

main() {
  final client =  PubClient();
}

Get Package Info #

Retrieves all available information about an specific package.

  final package =  await client.getPackage('package_name');

Get Package Score #

Returns the following score information about a package.

  • Pub Points
  • Popularity
  • Likes
  final score =  await client.getScore('package_name');

Get Package Versions #

The method getPackage also returns the versions. However if all you need is versions use this method since it's lighter.

  final package =  await client.getVersions('package_name');

Search Packages #

Allows you to search for packages on pub.dev. Will return the packages that match the query.

final results =  await client.search('query');
// Returns the packages that match the query
print(results.packages)

Paging Search Results #

You are able to page search results.

final results =  await client.search('query');
final nextResults = await results.nextPage();

print(nextResults.packages)

If you want to retrieve a specific result page you can call the page parameter directly.

final results =  await client.search('query',page:2);
print(results.packages)

Please file feature requests and bugs at the issue tracker.