PluginInstallCommand class

plugin:install <name>, register a third-party artisan plugin into the consumer project.

Two flows live in this command:

  1. Manifest flow (preferred): when the plugin ships an install.yaml at its package root or assets/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).

  2. Legacy flow (fallback): when no install.yaml is found, fall back to the original behaviour, append import 'package:<name>/cli.dart'; and registry.registerProvider(<Provider>()) to the consumer's bin/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>ArtisanProvider in that barrel. Override with --provider=ClassName when 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 (so flutter pub get ran).
  • bin/artisan.dart must 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

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 list next to name).
no setteroverride
hashCode int
The hash code for this object.
no setterinherited
name String
Dispatch key. Colons (:) act as namespace prefixes for artisan list grouping (e.g. dusk:snap groups under dusk).
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 true when the operator passed --dry-run.
inherited
isForce(ArtisanContext ctx) bool
Returns true when the operator passed --force.
inherited
isNonInteractive(ArtisanContext ctx) bool
Returns true when the operator passed --non-interactive.
inherited
isSkipBootstrap(ArtisanContext ctx) bool
Returns true when the operator passed --no-bootstrap.
inherited
isUseYamlOnly(ArtisanContext ctx) bool
Returns true when 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.yaml location, or null when the plugin ships no manifest.
toString() String
A string representation of this object.
inherited

Operators

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