omnystore_client library

OmnyStore client SDK — web-compatible, for apps that talk to a remote registry.

Nothing in this barrel imports dart:io, so it compiles to JavaScript and runs unchanged on the Dart VM, in Flutter, and in a browser. The only transport is package:http.

final client = OmnyStoreClient(baseUrl: 'https://store.example.com');

final latest = await client.latestRelease('omnyagent');

final update = await client.checkForUpdates(
  packageReference: 'omnyagent',
  currentVersion: Version.parse('1.0.0'),
  channel: ReleaseChannel.beta,
  platform: 'macos-arm64',
);
if (update.isInstallable) {
  final bytes = await client.downloadAsset(update.asset!.id);
}

OmnyStoreClient implements the same OmnyStoreApi as the embedded OmnyStore, and rebuilds the server's typed exceptions from the wire — so code written against the interface runs embedded or remote without change, and on ReleaseNotFoundException works either way.

On the Dart VM, package:omnystore/omnystore.dart adds the download manager (streaming to disk, resume, checksum verification) and the storage backends.

Classes

AnonymousAuthProvider
An AuthProvider that sends no credentials.
Asset
A downloadable file attached to a Release — a tarball, an installer, a checksum file, a signature.
AssetDownload
An open read of an asset's bytes, whichever provider ended up serving them.
AssetLocation
Records that one provider holds the bytes of one asset.
AuthProvider
Supplies the credentials a client attaches to each request.
ByteRange
A half-open-at-the-end byte range, in HTTP Range semantics: start and end are both inclusive, and end == null means "to the end of the object".
ChecksumResult
The size and digest of a byte stream, computed while it was being consumed.
Checksums
SHA-256 helpers used wherever OmnyStore hands bytes across a trust boundary: uploads into object storage, downloads onto a client's disk, and replication between providers.
ChecksumStream
A stream transformer that hashes and counts bytes as they flow through, leaving the data itself untouched.
CompositeAuthProvider
An AuthProvider that merges several providers' headers.
DownloadRecord
One recorded download of an Asset.
DownloadStats
Aggregated download counts, as returned by the downloads API.
DownloadTarget
Where a client should go to fetch an asset.
Eq
Structural equality helpers for the immutable models.
ErrorCodes
The error codes used by OmnyStore.
HttpDates
Parsing for the Last-Modified and Date headers the object-storage backends read.
Json
Manual JSON read helpers for the hand-written decode paths that json_serializable does not cover — API request bodies, error envelopes and the free-form metadata maps.
Names
Validation for the human-typed, URL-addressable names OmnyStore uses as secondary keys: organization, project and package names.
NullableVersionConverter
Serialises a nullable Version.
OmnyStoreApi
The registry's complete operation surface, implemented three times over.
OmnyStoreClient
The client SDK: an OmnyStoreApi backed by a remote OmnyStore server.
Organization
The top-level tenant: a company, a team, or an open-source org that owns projects.
Package
A distributable artifact line within a Project — the thing that has versions.
Project
A product or repository within an Organization, grouping the packages released together.
ProviderDescriptor
The public description of a storage provider: who it is, which organizations it serves, how its bytes are reached, and how much room it has left.
RedirectDownload
The client should follow url — a presigned bucket URL, or a signed URL at the node that holds the bytes.
RefreshingAuthProvider
An AuthProvider that fetches a token on demand and refreshes it when the server rejects it.
Release
A published version of a Package, with its notes and its Assets.
ReleaseQuery
Filters and paging for a release listing.
Sha256Accumulator
An incremental SHA-256 accumulator.
StreamedDownload
No URL could be issued, so the caller must stream the bytes itself through OmnyStoreApi.openAsset.
TokenAuthProvider
An AuthProvider sending a fixed bearer token.
UpdateChecker
The client-side update service: "am I running the newest build, and what should I download if not?".
UpdateInfo
The answer to "is there a newer version for me?".
UpdateResolver
The decision logic behind every update check, kept in one pure function so the embedded store, the hub, the REST endpoint and the standalone UpdateChecker cannot drift apart on the question that matters most: should this client be told to update?
Version
A parsed semantic version number.
VersionConstraint
A VersionConstraint is a predicate that can determine whether a given version is valid or not.
VersionConstraintConverter
Serialises a VersionConstraint as its string form ('^1.2.0', 'any').
VersionConverter
Serialises a Version as its canonical string form.
Versions
Version helpers that fail with OmnyStore's own typed exceptions instead of pub_semver's FormatException.

Enums

DataPlaneMode
How a provider's bytes reach a client.
ProviderKind
What kind of participant a storage provider is.
ProviderStatus
The liveness of a provider, as tracked by the hub.
ReleaseChannel
The distribution channel a release belongs to.
ReplicaState
Where a replica of an asset's bytes stands.

Constants

omnyStoreApiVersion → const String
The REST API version segment served by the API server (/api/v1).
omnyStoreVersion → const String
The canonical OmnyStore package version (kept in sync with pubspec.yaml).

Functions

omnyStoreExceptionForCode(String code, String message, {int statusCode = 500, Uri? url, Map<String, Object?> details = const {}}) OmnyStoreException
Reconstructs an OmnyStoreException from the code/message carried on a JSON error envelope — the inverse of the mapping the API server uses to render a thrown exception.

Exceptions / Errors

ApiException
The REST API answered with a status or body the client could not accept.
AssetNotFoundException
The referenced asset does not exist.
ChecksumMismatchException
Downloaded bytes did not match the checksum recorded for the asset.
CliException
The CLI was invoked incorrectly, or a command could not complete.
ConflictException
A resource with the same unique key already exists — a second organization with one name, a re-published version, an asset filename used twice within one release.
DownloadFailedException
A download could not be completed: the transport failed, the server answered with an error status, or the stream ended short of the expected length.
ForbiddenException
The caller is authenticated but not permitted to perform the operation.
InvalidJsonException
A payload could not be parsed as the expected JSON shape.
NotFoundException
A referenced resource does not exist.
OmnyStoreException
Base type for every expected failure raised by OmnyStore.
OmnyStoreTimeoutException
An operation exceeded its deadline.
OrganizationNotFoundException
The referenced organization does not exist.
PackageNotFoundException
The referenced package does not exist.
ProjectNotFoundException
The referenced project does not exist.
ReleaseNotFoundException
The referenced release does not exist.
StorageException
The object storage backend failed (unreachable bucket, denied credentials, an I/O error writing the local directory, ...).
UnauthorizedException
The caller is not authenticated (missing or invalid credentials).
UnsupportedOperationException
The configured backend does not support the requested operation — asking a local-directory store for a presigned URL, for instance.
ValidationException
Invalid input: a malformed name, an unparsable version, a negative size, a channel that does not match the version's pre-release tag, and so on.