ComponentLink class final
A node's link to a component (Node.component): the component's main
node, or the top node of an instance of it.
JSON (sparse): {"id": "cmp1", "role": "main", "version": 3, "settings": [...]}; role defaults to instance, version to 1.
A linked, Codelessly-managed instance also has managedJson
("managed": {...}, read as a ManagedComponentRef by the managed
library's ComponentLink.managed): id is then the managed component's
id and version the version its nodes (the snapshot) were built from.
- Available extensions
- Annotations
-
- @immutable
Constructors
-
ComponentLink({required String id, ComponentRole role = ComponentRole.instance, int version = 1, List<
ComponentSetting> settings = const [], Json? managedJson}) -
const
Properties
- hashCode → int
-
The hash code for this object.
no setteroverride
- id → String
-
The component's id (its ComponentDefinition.id).
final
- isInstance → bool
-
no setter
- isMain → bool
-
no setter
- isManaged → bool
-
Whether this is an instance of a Codelessly-managed component.
no setter
- managed → ManagedComponentRef?
-
Available on ComponentLink, provided by the ManagedLink extension
What a managed instance customizes and follows; null for a project component's link.no setter - managedJson → Json?
-
What a managed instance customizes and follows (channel, pin, setting
values by key, slots, events, theme tokens), as its JSON; null for a
project component's link. The managed library reads it
(
ComponentLink.managed, package:codelessly_api/managed.dart).final - role → ComponentRole
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
settings
→ List<
ComponentSetting> -
What the component lets an instance customize, aimed at this node's
tree (an instance's targets are its own copies' ids).
final
- version → int
-
The component's version this node was made from or last updated to:
an instance below ComponentDefinition.version has an update.
final
Methods
-
copyWith(
{String? id, ComponentRole? role, int? version, List< ComponentSetting> ? settings, Json? managedJson}) → ComponentLink -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
remapped(
Map< String, String> ids) → ComponentLink -
The link with every setting target's node id mapped by
ids(a copy of the tree with new ids). Idsidsdoesn't have are kept. -
toJson(
) → Json -
toString(
) → String -
A string representation of this object.
override
-
withManaged(
ManagedComponentRef? ref) → ComponentLink -
Available on ComponentLink, provided by the ManagedLink extension
This link withrefas its managed reference.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override
Static Methods
-
fromJson(
Object? json) → ComponentLink? -
Null without an id. Also reads the marker the editor kept in a
node's
extrabefore this model ({"id", "marker": "component" | "instance", "version"}).