패키지, 저장소 및 앱 카테고리 검색

패키지 상세v4.0.0

pub_api_client

Pub의 공개 패키지 정보와 상호 작용하기 위한 API 클라이언트입니다.

AndroidiOSmacOSWindowsLinux
30일 다운로드
18.6만
좋아요
70
Pub 점수
160

패키지 설치

flutter pub add pub_api_client

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

Flutter/Dart 패키지로, Pub 패키지 저장소와 상호작용할 수 있는 클라이언트를 제공하여 개발자가 메타데이터, 버전, 종속성 등의 공개 패키지 정보를 가져올 수 있도록 합니다. 간단함과 신뢰성을 위해 설계되었으며, 실시간으로 Dart 패키지 데이터에 접근이 필요한 앱에 원활하게 통합됩니다. 모바일, 데스크톱, 웹을 포함한 모든 주요 플랫폼을 지원하여 패키지 세부 정보를 분석하거나 표시하는 도구에 이상적입니다. leoafarias.com에서 유지보수되며, 투명성과 커뮤니티 기여를 위해 GitHub에 호스팅되어 있습니다.

사용 사례

  • 패키지 메타데이터 가져오는 중
  • 패키지 버전 표시
  • 패키지 종속성 분석
  • 패키지 검색 도구 구축
  • 개발 도구와의 통합

주요 기능

  • 간단한 API 인터페이스
  • 크로스 플랫폼 지원
  • 실시간 패키지 데이터
  • GitHub 호스팅 소스 코드
  • 공식 Pub 저장소 통합

적합한 대상

  • Dart 패키지 탐색기
  • 개발자 도구 앱
  • 의존성 분석 유틸리티
  • Dart 패키지에 관한 교육용 앱
  • CI/CD 파이프라인 통합

고려 사항

  • 인터넷 연결이 필요합니다
  • 레이트 제한이 적용될 수 있습니다
  • 공개 패키지 데이터에 한정
  • 개인 패키지 관리에 적합하지 않습니다
  • 외부 Pub 서비스의 안정성에 의존

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

drawing

Pub Version Pub Likes Pub Points Coverage Status MIT Licence

An unofficial API client for Pub.dev

This package aims to be a complete, stable pub.dev API client. If an endpoint is missing, please open an issue.

Table of contents

Usage

A simple usage example:

import 'package:pub_api_client/pub_api_client.dart';

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

API

Packages
Get Package Info

Retrieves all available information about a specific package.

final package = await client.packageInfo('pkg_name');

Package pubspec dependencies retain their typed source metadata. The public library exports HostedDependency, GitDependency, PathDependency, and SdkDependency so consumers can inspect constraints, URLs, refs, subpaths, and SDK names without importing an implementation dependency separately.

Get Package Score

Returns the following score information about a package.

  • Pub Points (grantedPoints / maxPoints)
  • Likes (likeCount)
  • 30-day downloads (downloadCount30Days)
  • Tags
final score = await client.packageScore('pkg_name');

popularityScore is always null — pub.dev retired the popularity score. Use downloadCount30Days instead.

Get Package Metrics

The packageMetrics method returns a package score and scorecard.

final metrics = await client.packageMetrics('pkg_name');
final weekly = metrics?.scorecard.weeklyVersionDownloads;
if (weekly != null && weekly.totalWeeklyDownloads.isNotEmpty) {
  print('Latest weekly downloads: ${weekly.totalWeeklyDownloads.last}');
}

When supplied by the server, the scorecard includes total weekly downloads and major, minor, and patch version-range histories.

Get Package Versions

The packageVersions method returns only the published version strings.

final versions = await client.packageVersions('pkg_name');
Get Package Version Info

The packageVersionInfo method returns information about a specific package version.

final version = await client.packageVersionInfo('pkg_name', 'version');
Get Package Version Score

The method packageVersionScore returns the score of a single version.

final score = await client.packageVersionScore('pkg_name', 'version');
Get Package Version Options

The method packageVersionOptions tells whether a specific version has been retracted.

final options = await client.packageVersionOptions('pkg_name', 'version');
print(options.isRetracted);
Get Package Publisher

The packagePublisher method returns the publisher ID of a specific package.

final publisher = await client.packagePublisher('pkg_name');
print(publisher.publisherId);
Get Package Likes

The method packageLikes returns the public like count of a package. Unlike the like endpoints this does not require authentication.

final likes = await client.packageLikes('pkg_name');
print(likes.likes);
Get Package Options

The method packageOptions returns options of a package.

final options = await client.packageOptions('pkg_name');
Get Documentation

The documentation method returns each version and its documentation status.

final documentation = await client.documentation('pkg_name');
Get Security Advisories

The method packageAdvisories returns the security advisories affecting a package, in OSV format. Returns null when the server does not implement the endpoint.

final advisories = await client.packageAdvisories('pkg_name');
if (advisories != null && advisories.advisories.isNotEmpty) {
  print(advisories.advisories.first.pubDisplayUrl);
}
Publishers
Get Publisher Info

The method publisherInfo returns the public profile of a publisher.

final publisher = await client.publisherInfo('dart.dev');
print(publisher.description);
Like Packages

The endpoints in this section inspect or change the authenticated user's like state and require pub.dev authentication. The package-wide count returned by packageLikes is public.

List liked packages

Returns the packages liked by the authenticated user.

final likes = await client.listPackageLikes();
Package Like Status

Returns like status of a package.

final like = await client.likePackageStatus('pkg_name');
Like a Package

Likes a package and returns its authenticated like status.

final like = await client.likePackage('pkg_name');
Unlike a Package

Unlikes a package.

await client.unlikePackage('pkg_name');
Search Packages

Searches pub.dev for packages matching a query, with optional tag and topic filters.

final results = await client.search(
  'query',
  tags: [
    PackageTag.publisher('publisher_id'),
    PackageTag.dependency('dependency_name'),
    'another:tag',
  ],
  topics: ['topic_1', 'topic_2'],
);
// Returns the packages that match the query
print(results.packages);
Sorting search results

Search results support these orderings:

Value Orders by
SearchOrder.top Weighted text, downloads, points, and likes
SearchOrder.text Text-match similarity
SearchOrder.created Package creation time
SearchOrder.updated Last update time
SearchOrder.downloads Download count
SearchOrder.like Like count
SearchOrder.points Pub points
SearchOrder.trending Trend score
final results = await client.search('query', sort: SearchOrder.updated);

print(results.packages);

SearchOrder.popularity is deprecated. pub.dev no longer accepts it and silently serves those requests as SearchOrder.top. Use SearchOrder.downloads.

Paging Search Results

Use the next URL to page through search results.

final results = await client.search('query');
final nextPage = results.next;
if (nextPage != null) {
  final nextResults = await client.nextPage(nextPage);
  print(nextResults.packages);
}

To retrieve a specific result page, pass the page parameter directly.

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

pub.dev stops returning a next link after page 10, so paging through a search yields at most 100 packages.

Completion Data
Package Names

packageNameCompletion returns the top package names on pub.dev, and packageNames returns every package name in one gzip-compressed response.

final top = await client.packageNameCompletion();
final all = await client.packageNames();
Topics

topicNameCompletion returns every topic mapped to the number of packages using it.

final topics = await client.topicNameCompletion();
// {'flutter': 1234, 'http': 567, ...}

Utilities

Flutter Favorites

Returns all Flutter favorites on pub.dev.

final results = await client.fetchFlutterFavorites();
Google Packages

Returns official Google packages across the known Google publishers.

final results = await client.fetchGooglePackages();
Publisher Packages

Returns all packages for a specific publisher.

final results = await client.fetchPublisherPackages('dart.dev');
All Packages

Returns all packages that match a given query.

final results = await client.fetchAllPackages(
  '',
  tags: [PackageTag.publisher('leoafarias.com')],
);

pub.dev caps each search at 10 pages. fetchAllPackages, fetchPublisherPackages, and fetchFlutterFavorites therefore return at most 100 packages per query. fetchGooglePackages applies the same limit separately to each known publisher.

카테고리

의존성

의존성 목록 5 개

소스 저장소

이 패키지를 사용하는 프로젝트