PluginInstallCommand class
plugin:install <name>, register a third-party artisan plugin into the
consumer project.
Two flows live in this command:
-
Manifest flow (preferred): when the plugin ships an
install.yamlat its package root orassets/install.yaml, parse it via ManifestParser, translate it via ManifestInstaller, and commit through the PluginInstaller DSL. This is the standard Plugin Authoring Guide path (declarative; supports dry-run, conflict detection, install records, reverse on uninstall). -
Legacy flow (fallback): when no
install.yamlis found, fall back to the original behaviour, appendimport 'package:<name>/cli.dart';andregistry.registerProvider(<Provider>())to the consumer'sbin/artisan.dart. Kept for backward compatibility with plugins authored before the manifest schema landed.
Pass --use-yaml-only to make the manifest flow strict: when no
manifest is found the command errors out instead of falling back.
Plugin authoring conventions assumed by the legacy flow:
- Plugin exports a CLI barrel at
package:<name>/cli.dart. - Plugin declares a provider class named
<PascalCaseName>ArtisanProviderin that barrel. Override with--provider=ClassNamewhen the plugin uses a different naming convention.
Pre-flight validation (both flows):
- The package must be listed in the consumer's
pubspec.yaml. - The package must be resolvable via
.dart_tool/package_config.json(soflutter pub getran). bin/artisan.dartmust exist (legacy flow injects into it; manifest flow keeps it as the conventional wrapper).
Dart has no auto-discovery for service providers (no dart:mirrors under
AOT, no Laravel-style composer.json extras). This command IS the
substitute: the consumer adds the dep + runs plugin:install <name> once
and never touches bin/artisan.dart by hand.
- Inheritance
-
- Object
- ArtisanCommand
- ArtisanInstallCommand
- PluginInstallCommand
Constructors
- PluginInstallCommand()
- Public default constructor. Test fixtures subclass + override getProjectRoot / resolveInstallYaml to inject deterministic paths without depending on the host's filesystem layout.
Properties
- baseFlags → String
-
Standard install-command flag fragment interpolated into every concrete
subclass's signature.
no setterinherited
- boot → CommandBoot
-
Install commands run before the Flutter app boots: no VM Service, no
connected isolate. The dispatcher constructs a ArtisanContext.bare.
no setterinherited
- description → String
-
One-line description (rendered in
artisan listnext to name).no setteroverride - hashCode → int
-
The hash code for this object.
no setterinherited
- name → String
-
Dispatch key. Colons (
:) act as namespace prefixes forartisan listgrouping (e.g.dusk:snapgroups underdusk).no setterinherited - parsedSignature → CommandSignature?
-
Lazy-parsed signature. Cached for the lifetime of the instance.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- signature → String
-
Optional Laravel-style signature DSL. When set, name derives from
it and configure auto-registers the declared options/flags.
no setteroverride
Methods
-
buildContext(
ArtisanContext ctx) → InstallContext -
Constructs the production InstallContext wired around
ctx.inherited -
configure(
ArgParser parser) → void -
Auto-applies signature to the parser when set. Override to register
extra ArgParser features (mandatory options, aliases, custom value
validators). When you override, call
super.configure(parser)first if you also use the signature DSL.inherited -
getProjectRoot(
) → String - Resolves the consumer project root. Hook for test subclasses; production path defers to FileHelper.findProjectRoot.
-
handle(
ArtisanContext ctx) → Future< int> -
Execute the command. Returns the process exit code.
override
-
isDryRun(
ArtisanContext ctx) → bool -
Returns
truewhen the operator passed--dry-run.inherited -
isForce(
ArtisanContext ctx) → bool -
Returns
truewhen the operator passed--force.inherited -
isNonInteractive(
ArtisanContext ctx) → bool -
Returns
truewhen the operator passed--non-interactive.inherited -
isSkipBootstrap(
ArtisanContext ctx) → bool -
Returns
truewhen the operator passed--no-bootstrap.inherited -
isUseYamlOnly(
ArtisanContext ctx) → bool -
Returns
truewhen the operator passed--use-yaml-only. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
pluginName(
ArtisanContext ctx) → String -
Identifier of the plugin this install command targets.
override
-
resolveInstallYaml(
String pluginName) → Future< String?> -
Resolves the plugin's
install.yamllocation, ornullwhen the plugin ships no manifest. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited