PluginOperationsService class
Core plugin operations — install, uninstall, enable, disable, update.
Functions in this class:
- Do NOT call exit or write to stdout directly.
- Return result objects indicating success/failure with messages.
- Can throw for unexpected failures.
Dependencies are injected as callbacks so the service can be used by both CLI commands and interactive UI without coupling to I/O.
Constructors
-
PluginOperationsService({required Future<
PluginLoadResult> loadAllPluginsFn(), required Future<PluginManifest?> getPluginByIdFn(String pluginId), required Map<String, bool> ? getSettingsEnabledPlugins(String source), required void updateSettings(String source, Map<String, Object?> update), required void clearAllCaches(), required Map<String, List< loadInstalledPluginsV2(), required void removePluginInstallation(String pluginId, PluginScope scope, String? projectPath), required Future<PluginInstallationRecord> >void> markVersionOrphaned(String installPath), required void deletePluginOptions(String pluginId), required Future<void> deletePluginDataDir(String pluginId), required List<String> findReverseDependents(String pluginId, List<LoadedPlugin> allPlugins), required bool isPluginBlockedByPolicy(String pluginId), required String getOriginalCwd()}) - Create the service with all required dependency callbacks.
Properties
- clearAllCaches → void Function()
-
Clear all plugin caches.
final
-
deletePluginDataDir
→ Future<
void> Function(String pluginId) -
Delete a plugin's data directory.
final
- deletePluginOptions → void Function(String pluginId)
-
Delete plugin options and secrets.
final
-
findReverseDependents
→ List<
String> Function(String pluginId, List<LoadedPlugin> allPlugins) -
Find plugins that depend on
pluginId.final - getOriginalCwd → String Function()
-
Get the current working directory (for project-scoped installs).
final
-
getPluginByIdFn
→ Future<
PluginManifest?> Function(String pluginId) -
Look up a plugin entry in any marketplace.
final
-
getSettingsEnabledPlugins
→ Map<
String, bool> ? Function(String source) -
Read the enabledPlugins map from a settings source.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- isPluginBlockedByPolicy → bool Function(String pluginId)
-
Check if a plugin is blocked by organizational policy.
final
-
loadAllPluginsFn
→ Future<
PluginLoadResult> Function() -
Load all plugins (enabled + disabled).
final
-
loadInstalledPluginsV2
→ Map<
String, List< Function()PluginInstallationRecord> > -
Load installed plugins from V2 on-disk data.
final
-
markVersionOrphaned
→ Future<
void> Function(String installPath) -
Mark a versioned install path as orphaned for GC.
final
- removePluginInstallation → void Function(String pluginId, PluginScope scope, String? projectPath)
-
Remove a plugin installation entry from V2 data.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
updateSettings
→ void Function(String source, Map<
String, Object?> update) -
Write an update to a settings source.
final
Methods
-
disableAllPlugins(
) → Future< PluginOperationResult> - Disable all enabled plugins across all editable scopes.
-
disablePlugin(
String plugin, [PluginScope? scope]) → Future< PluginOperationResult> - Disable a plugin.
-
enablePlugin(
String plugin, [PluginScope? scope]) → Future< PluginOperationResult> - Enable a plugin.
-
findPluginByIdentifier(
String plugin, List< LoadedPlugin> plugins) → LoadedPlugin? - Find a plugin from loaded plugins by identifier.
-
findPluginInSettings(
String plugin) → ({String pluginId, PluginScope scope})? - Search all editable settings scopes for a plugin ID.
-
getProjectPathForScope(
PluginScope scope) → String? - Get the project path for scopes that are project-specific.
-
installPlugin(
String plugin, [PluginScope scope = PluginScope.user]) → Future< PluginOperationResult> - Install a plugin (settings-first).
-
isPluginEnabledAtProjectScope(
String pluginId) → bool - Check if a plugin is enabled at project scope.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
uninstallPlugin(
String plugin, [PluginScope scope = PluginScope.user, bool deleteDataDirFlag = true]) → Future< PluginOperationResult> - Uninstall a plugin.
-
updatePlugin(
String plugin, PluginScope scope) → Future< PluginUpdateResult> - Update a plugin to the latest version.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited