SocketRef<K extends SocketKind> class final

A reference to a socket: a named place in a template that receives contributions of the kind K.

A socket belongs to a role, to a module, or to the pipeline. A template marks it with a tag, {{{<tag>}}}, and the pipeline replaces the tag with the rendered contributions. Usually the owner's template holds the tag; a member of a SocketFamily may be tagged in the files its key refers to, such as the screen file of a feature. Modules refer to sockets only through these typed references, never by tag, so a misspelled socket does not compile.

Who may contribute to a socket:

  • a socket of a role: modules that provide, require or use the role, and the templates of the role and of the roles that require or use it;
  • a socket of a module: modules that depend on that module directly;
  • a socket of the pipeline: nobody, see PipelineSocket.

The sockets of a role that is Role.openToAllModules, such as the app entry, are open to every module. See SocketContribution for the order of contributions.

Available extensions
Annotations
  • @immutable

Constructors

SocketRef.module(ModuleId module, String name, K kind)
Refers to the socket name of the module module.
const
SocketRef.role(Role<Object> role, String name, K kind)
Refers to the socket name of role.
const

Properties

familyKey → List<String>
The key segments of a member of a SocketFamily, empty otherwise.
final
hashCode → int
The hash code for this object.
no setteroverride
isPipeline → bool
Whether the pipeline owns the socket.
no setter
kind → K
What the socket accepts.
final
module → ModuleId?
The module that owns the socket, if a module does.
final
name → String
The name of the socket, in lower snake_case and unique for its owner.
final
ownerName → String
The name of the owner: the id of the role or module, or pipeline.
no setter
role → Role<Object>?
The role that owns the socket, if a role does.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
tag → String
The name of the socket's tag in templates, such as smf_app_entry__bootstrap_platform.
no setter
tags → List<String>
The tags of the socket: tag, or <tag>_open and <tag>_close for a WrapperSocket.
no setter

Methods

entry(String key, V value, {Set<Role<Object>> when = const {}}) → SocketContribution

Available on SocketRef<KeyedSocket<V>>, provided by the KeyedSocketContributions extension

Adds the entry key with value to this socket.
key(String key, {Set<Role<Object>> when = const {}}) → SocketContribution

Available on SocketRef<KeyedSocket<NoValue>>, provided by the KeySocketContributions extension

Adds key to this socket.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
problems() → List<String>
Describes what is wrong with the name of this socket, or returns an empty list.
problemsWith(SocketContribution contribution) → List<String>
Describes what is wrong with contribution to this socket, or returns an empty list: a contribution for another socket, a payload of the wrong shape or type, an unknown argument, a value the merge policy rejects, or a problem of its fragment.
render(List<SocketContribution> contributions) → Map<String, String>
Renders contributions to this socket, already in their final order, and returns the text of each of the socket's tags.
toString() → String
A string representation of this object.
override
value(V value, {Set<Role<Object>> when = const {}}) → SocketContribution

Available on SocketRef<ValueSocket<V>>, provided by the ValueSocketContributions extension

Contributes value to this socket.

Operators

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