TagExtension constructor

TagExtension({
  1. required Set<String> tagsToExtend,
  2. Widget? child,
  3. Widget builder(
    1. ExtensionContext
    )?,
})

TagExtension allows you to extend the functionality of flutter_html by defining a mapping from a custom or existing tag to a widget.

If instead you'd like to wrap a tag (or custom tag) in a widget, see TagWrapExtension.

Implementation

TagExtension({
  required this.tagsToExtend,
  Widget? child,
  Widget Function(ExtensionContext)? builder,
}) : assert((child != null) || (builder != null),
          "Either child or builder needs to be provided to TagExtension") {
  if (child != null) {
    this.builder = (_) => WidgetSpan(child: child);
  } else {
    this.builder = (context) => WidgetSpan(child: builder!.call(context));
  }
}