TagExtension constructor
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));
}
}