SharedCommand class

A StandardCommand published for cross-app reuse (FR-006).

Add a version to a StandardCommand and publish it via share to make it discoverable by other apps. Retrieval via retrieve checks the version constraint and throws VersionMismatchException on mismatch.

Annotations

Constructors

SharedCommand({required StandardCommand command, required String version})
const
SharedCommand.of(StandardCommand command, {String version = '0.1.0'})
Construct a SharedCommand from a StandardCommand and a version string.
factory

Properties

command → StandardCommand
The command definition being shared.
final
hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
version → String
The version of this shared definition. Must be a simplified SemVer (e.g. '1.0.0'). Used by retrieve's minVersion check.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
share(CommandRegistry registry, {required String ownerApp}) → void
Publish this shared command to a CommandRegistry under the command's name and the given owner app.
toString() → String
A string representation of this object.
inherited

Operators

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

Static Methods

retrieve(CommandRegistry registry, {required String ownerApp, required String commandName, String? minVersion}) → SharedCommand
Retrieve a shared command from a CommandRegistry by name.
versionSatisfies(String published, String minimum) → bool
Compare two simplified SemVer strings. Returns true if published is greater than or equal to minimum.