ContentPlugin class abstract
The base class for a Content Plugin.
Register it with PluginDescriptor(others: [...]) and reach it through
vyuh.content (or VyuhBinding.instance.content in widget mode).
- Inheritance
-
- Object
- Plugin
- ContentPlugin
- Implementers
- Available extensions
Constructors
- ContentPlugin({required ContentProvider provider, required String name, required String title, UnknownContentBuilder? unknown})
- Creates a new ContentPlugin with the given provider, name, and title
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- name → String
-
finalinherited
- provider → ContentProvider
-
The ContentProvider for this plugin
final
- 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 setter
- unknown → UnknownContentBuilder
-
Builds the widget shown when a content type, layout, modifier, action or
condition is missing. Defaults to UnknownContentView.
final
Methods
-
attach(
ExtensionBuilder< ExtensionDescriptor> extBuilder) → void - Sets up the plugin with the ContentExtensionBuilder. The plugin relies on the ContentExtensionBuilder to do its work.
-
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
layoutto override the default layout -
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.
-
contentBuilder(
String schemaType) → ContentBuilder< ContentItem> ? -
Available on ContentPlugin, provided by the ServiceExtensions extension
Returns the ContentBuilder for theschemaTypeof 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> -
inherited
-
fromJson<
T> (Map< String, dynamic> json) → T? - Converts the given json to an item of type T
-
init(
) → Future< void> -
inherited
-
isRegistered<
T> (String schemaType) → bool - Checks if the given schema type is registered for type T
-
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
-
setDefaultLayout(
{required String schemaType, required LayoutConfiguration< ContentItem> layout, required FromJsonConverter<LayoutConfiguration< fromJson}) → boolContentItem> > -
Available on ContentPlugin, provided by the ServiceExtensions extension
Sets the default layout for theschemaTypeof 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