DefaultContentPlugin class final

The default ContentPlugin implementation for the Vyuh framework. This plugin is responsible for fetching content from a CMS and rendering content items. It uses a ContentExtensionBuilder to keep track of the various ContentItem types.

Inheritance
  • Object
  • Plugin
  • ContentPlugin
  • DefaultContentPlugin
Available extensions

Constructors

DefaultContentPlugin({required ContentProvider provider, bool useLiveRoute = false, bool allowRouteRefresh = true})

Properties

allowRouteRefresh → bool
Whether to allow manual refreshing of the route.
final
hashCode → int
The hash code for this object.
no setterinherited
name → String
finalinherited
provider → ContentProvider
The ContentProvider for this plugin
finalinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
title → String
finalinherited
typeRegistry → Map<Type, Map<String, TypeDescriptor>>
The type registry that maps types to their descriptors. This stores the descriptors for LayoutConfiguration, ActionConfiguration, ConditionConfiguration and possibly others in the future.
no setteroverride
useLiveRoute → bool
Whether to use live route updates via streams. When true, uses RouteStreamBuilder for real-time updates. When false, uses RouteFutureBuilder for one-time loading.
final

Methods

attach(ExtensionBuilder<ExtensionDescriptor> extBuilder) → void
Sets up the plugin with the ContentExtensionBuilder. The plugin relies on the ContentExtensionBuilder to do its work.
override
buildContent<T extends ContentItem>(BuildContext context, T content, {LayoutConfiguration<T>? layout}) → Widget
Builds a Widget for the given content. You can pass in an optional layout to override the default layout
override
buildRoute(BuildContext context, {Uri? url, String? routeId}) → Widget
Builds a Widget for the given route url or id. This is used for top-level documents called routes. These could represent a page, dialog or a conditional-route.
override
contentBuilder(String schemaType) → ContentBuilder<ContentItem>?

Available on ContentPlugin, provided by the ServiceExtensions extension

Returns the ContentBuilder for the schemaType of the ContentItem. Returns null if it does not exist.
contentBuilders() → List<ContentBuilder<ContentItem>>?

Available on ContentPlugin, provided by the ServiceExtensions extension

Returns a map of all content builders, where the key is the schemaType and the value is the ContentBuilder.
dispose() → Future<void>
override
fromJson<T>(Map<String, dynamic> json) → T?
Converts the given json to an item of type T
override
init() → Future<void>
override
isRegistered<T>(String schemaType) → bool
Checks if the given schema type is registered for type T
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
register<T>(TypeDescriptor<T> descriptor) → void
Registers the given type descriptor
override
setDefaultLayout({required String schemaType, required LayoutConfiguration<ContentItem> layout, required FromJsonConverter<LayoutConfiguration<ContentItem>> fromJson}) → bool

Available on ContentPlugin, provided by the ServiceExtensions extension

Sets the default layout for the schemaType of the ContentItem. Returns true if the layout was set, false otherwise.
toString() → String
A string representation of this object.
inherited

Operators

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