PubApiClient class

Fetches and parses pub.dev package metadata.

Combining data from the /packages/<name> and /packages/<name>/score endpoints it builds PackageMetadata objects suitable for risk scoring.

Constructors

PubApiClient({Client? client, DiskCache? cache, int concurrency = 8, Duration timeout = const Duration(seconds: 15), int retries = 3})
Creates a PubApiClient.

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

dispose() → void
Closes the underlying HTTP client. Call this when done with the instance.
fetch({required String name, required Version currentVersion, bool fresh = false}) Future<PackageMetadata?>
Fetches metadata for a single name/currentVersion pair.
fetchAll(Map<String, Version> packages, {bool fresh = false}) Future<Map<String, PackageMetadata>>
Fetches metadata for all packages concurrently.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
probe(Uri url) Future<bool?>
Sends a HEAD request to url to check reachability.
Searches pub.dev for packages matching query.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited