LayoutDocument class final

A layout: a set of node trees (one per canvas/screen) in one flat map.

Available extensions
Annotations
  • @immutable

Constructors

LayoutDocument({String id = '', List<String> roots = const [], Map<String, Node> nodes = const {}, Json extra = const {}, Catalog? catalog})

Properties

breakpoints → Breakpoints

Available on LayoutDocument, provided by the LayoutDocumentBreakpoints extension

The project's breakpoints as this document has them (Breakpoints.defaults when it has none).
no setter
catalog → Catalog?
The catalog the document was decoded with; null for one built in code. Not part of its value.
final
componentRoot → String?

Available on LayoutDocument, provided by the ComponentDocument extension

The definition's root node id.
no setter
componentType → String?

Available on LayoutDocument, provided by the ComponentDocument extension

The component's type name (its widget.type); null when it isn't one.
no setter
componentVariables → List<Variable>

Available on LayoutDocument, provided by the ComponentDocument extension

Its own variables: one set per instance (keyed by its root, as a canvas's are).
no setter
extra → Json
Keys this version doesn't model (variables, conditions...), kept.
final
hashCode → int
The hash code for this object.
no setterinherited
id → String
final
isComponent → bool

Available on LayoutDocument, provided by the ComponentDocument extension

Whether it is a component definition: a widget declaration with a type, and exactly one root.
no setter
logic → LayoutLogic

Available on LayoutDocument, provided by the LayoutDocumentLogic extension

Its variables and conditions (read from LayoutDocument.extra).
no setter
nodes → Map<String, Node>
final
previews → List<ComponentPreview>

Available on LayoutDocument, provided by the ComponentDocument extension

Its previews (previews).
no setter
roots → List<String>
Top-level nodes (canvases), in order.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
scripts → List<ScriptDef>

Available on LayoutDocument, provided by the LayoutDocumentScripts extension

no setter
widget → WidgetSpec?

Available on LayoutDocument, provided by the ComponentDocument extension

Its declaration (widget), or null when it isn't a component.
no setter

Methods

callsTo(Set<String> types) → Iterable<Node>

Available on LayoutDocument, provided by the ComponentDocument extension

The call nodes in it: nodes whose type is one of types (component type names).
copyWith({String? id, List<String>? roots, Map<String, Node>? nodes, Json? extra}) → LayoutDocument
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
parentNodeOf(String id) → Node?
parentOf(String id) → String?
The parent of id (derived from children and slots; never stored).
script(String idOrName) → ScriptDef?

Available on LayoutDocument, provided by the LayoutDocumentScripts extension

The script idOrName names: by id, else by name, a page script over a project one.
subtree(String id) → Iterable<Node>
id and its descendants, depth first.
toJson() → Json
toString() → String
A string representation of this object.
inherited
withBreakpoints(Breakpoints value) → LayoutDocument

Available on LayoutDocument, provided by the LayoutDocumentBreakpoints extension

This document with value as its breakpoints (the defaults are stored as nothing).
withLogic(LayoutLogic logic) → LayoutDocument

Available on LayoutDocument, provided by the LayoutDocumentLogic extension

This document with logic as its variables and conditions.

Operators

operator ==(Object other) → bool
The equality operator.
inherited
operator [](String id) → Node?

Static Methods

fromJson(Object? json, {Catalog? catalog}) → LayoutDocument
Decodes a document of schema kSchemaVersion with catalog (default: Catalog.current). A map of any other schema, or with no schema, is refused: it throws an UnsupportedSchemaException saying the schema found and the one read. Otherwise it never throws: JSON that is not a map is an empty document, entries that aren't nodes are dropped, and a node or action type the catalog doesn't declare is kept as it is.