SocketContribution class final
Code or a value for a socket.
Each way of creating one takes a socket of one kind, so a contribution cannot target a socket that does not take it:
- SocketContribution.code for a CodeSocket;
- SocketContribution.arg for an ArgsSocket;
- SocketContribution.wrap for a WrapperSocket;
- SocketContribution.item for a FactoryListSocket;
socket.entry(key, value)andsocket.key(key)for a KeyedSocket (see KeyedSocketContributions);socket.value(value)for a ValueSocket (see ValueSocketContributions).
See SocketRef for who may contribute to which sockets.
Order
The pipeline renders the contributions of a socket, and runs every PostGenStep, in an order given by edges between all modules of the app and the templates of its roles:
- A module comes after the modules it depends on.
- If a module requires a role, or has it in Contribution.when, it comes after the role's providers and the role's template.
- A role's template comes after the role's providers, and after the providers and templates of the roles its role requires or has in its Contribution.when.
Two contributors with edges both ways ignore both edges, unless one depends on the other, which then comes after it. A contributor comes after every contributor it reaches through the edges, also through modules that do not contribute to the socket: a module that requires a role comes after the modules the role's provider depends on. Otherwise contributors are ordered by id. A cycle of edges is an error. Phases, such as the start-up phases of the app entry, are separate sockets.
- Inheritance
-
- Object
- Contribution
- SocketContribution
Constructors
-
SocketContribution.arg(SocketRef<
ArgsSocket> socket, String argName, Fragment fragment, {Set<Role< when = const {}})Object> > -
Sets the argument
argNameof an ArgsSocket to the expressionfragment, or adds it to a list argument.const -
SocketContribution.code(SocketRef<
CodeSocket> socket, Fragment fragment, {Set<Role< when = const {}})Object> > -
Adds
fragmentto a CodeSocket.const -
SocketContribution.item(SocketRef<
FactoryListSocket> socket, Fragment fragment, {Set<Role< when = const {}})Object> > -
Adds the function expression
fragment, such as a factory, to a FactoryListSocket.const -
SocketContribution.wrap(SocketRef<
WrapperSocket> socket, Fragment fragment, {Set<Role< when = const {}})Object> > -
Adds the wrapper
fragment, created with Fragment.wrap, to a WrapperSocket.const
Properties
- argName → String?
-
The argument name, for an ArgsSocket.
final
- entryKey → String?
-
The key, for a KeyedSocket.
final
- entryValue → Object?
-
The value, for a KeyedSocket or ValueSocket.
final
- fragment → Fragment?
-
The code, for sockets that take fragments.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- origin → ContributionOrigin?
-
Who contributed it.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
socket
→ SocketRef<
SocketKind> -
The socket the contribution is for.
final
-
when
→ Set<
Role< Object> > -
Roles that must all be present for the contribution to apply.
finalinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
withOrigin(
ContributionOrigin origin) → SocketContribution -
Returns a copy of this contribution contributed by
origin.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited