Plugin class abstract

An app-level plugin: a self-contained bundle of services, resources, and behaviour that can be installed into a DI scope at runtime and removed cleanly later. Use these to make whole features pluggable — themes, auth providers, analytics backends, optional integrations, etc.

Each installed plugin owns a fresh child DI scope keyed by id. Anything registered into that scope during install is torn down automatically on uninstall — including ServiceMixin services, whose dispose() is cascaded via the standard unregister hook.

Distinct from EcsPlugin (in src/ecs/ecs.dart), which bundles systems and resources into an ECS World rather than a DI scope.

Annotations

Constructors

Plugin()
const

Properties

hashCode int
The hash code for this object.
no setterinherited
id Entity
Identifies this plugin within a host DI scope. Defaults to TypeEntity(runtimeType), so only one instance of a given Plugin subclass can be installed in the same scope at once. Override to support multiple coexisting variants (e.g. multiple ThemePlugins keyed by name).
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

install(DI scope) Resolvable<Unit>
Called when this plugin is installed. scope is a fresh child DI scope owned by this plugin — register services, resources, and nested scopes here. Everything in scope is torn down automatically on uninstall.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
uninstall(DI scope) Resolvable<Unit>
Called when this plugin is uninstalled, before scope is torn down. Use this only for cleanup the registry cannot do automatically — e.g. deregistering from singletons living outside scope, closing external resources not held as services.

Operators

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