ContentItem class abstract
The base class for all content items in Vyuh.
A content item represents a piece of content that can be:
- Fetched from a Content Management System (CMS)
- Rendered on screen with a specific layout
- Modified with content modifiers
- Organized in a content hierarchy
Content items are the building blocks of a Vyuh application's content. They combine data from the CMS with presentation logic to create rich, interactive user interfaces.
Example:
@JsonSerializable()
class BlogPost extends ContentItem {
static const schemaName = 'blog.post';
final String title;
final String content;
BlogPost({
required this.title,
required this.content,
super.layout,
super.modifiers,
}) : super(schemaType: schemaName);
}
- Implemented types
- Implementers
- Annotations
-
- @JsonSerializable(createFactory: false)
Constructors
-
ContentItem.new({required String schemaType, required LayoutConfiguration<
ContentItem> ? layout, required List<ContentModifierConfiguration> ? modifiers}) - Creates an instance of ContentItem.
-
ContentItem.fromJson(Map<
String, dynamic> json) -
Converts the JSON representation of the content item to an instance of ContentItem.
factory
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
-
layout
→ LayoutConfiguration<
ContentItem> ? -
The layout configuration for the content item.
final
-
modifiers
→ List<
ContentModifierConfiguration> ? -
final
- parent ↔ ContentItem?
-
The parent content item of this content item. This is used internally by the content system.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- schemaType → String
-
The schema type of the content item.
final
Methods
-
getLayout(
) → LayoutConfiguration< ContentItem> ? - Gets the layout to use for the ContentItem. By default its the layout itself. However this acts as an extension point for custom ContentItems that may have a different strategy for applying layouts.
-
getModifiers(
) → List< ContentModifierConfiguration> ? - Gets the modifiers to use for the ContentItem. By default its the modifiers itself. However this acts as an extension point for custom ContentItems that may have a different strategy for applying modifiers.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
setParent(
Iterable< ContentItem?> children) → void - Sets the parent content item for the given list of children.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
modifierList(
dynamic json) → List< ContentModifierConfiguration> ?