CobaltScopeRoot class

Names the root scope and makes the generator emit a start function.

Annotate any one class in the package — it is a marker, nothing is registered from it. The generator then emits cobaltRootScopeName and startCobalt(), which wires the container, the bootstrap list and the name together:

@CobaltScopeRoot(name: 'app')
class AppScope {
  const AppScope();
}

final scope = await startCobalt();

Without the annotation the root scope is called root. Two annotated classes in one package is a generation error, since the package can only have one root.

Annotations
  • @Target.new({TargetKind.classType})

Constructors

CobaltScopeRoot({String name = 'root', List<Object> provides = const []})
Creates an annotation naming the root scope.
const

Properties

hashCode → int
The hash code for this object.
no setterinherited
name → String
The name the root scope reports, used in error messages and when inspecting the scope tree.
final
provides → List<Object>
Registrations the generated container does not make, but may depend on.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

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