build method

  1. @override
dynamic build(
  1. Object? context, {
  2. bool asElement = true,
  3. bool resolveDSX = true,
  4. QueryElementProvider? elementProvider,
  5. IntlMessageResolver? intlMessageResolver,
})
override

Implementation

@override
dynamic build(Object? context,
    {bool asElement = true,
    bool resolveDSX = true,
    QueryElementProvider? elementProvider,
    IntlMessageResolver? intlMessageResolver}) {
  if (elementProvider == null) return '';
  var element = elementProvider(query)!;

  if (element == null) {
    return null;
  } else if (element is String) {
    if (!asElement) {
      return element;
    }

    var template = DOMTemplate.parse(element);
    if (!template.hasOnlyContent) {
      return template.build(context,
          asElement: true,
          resolveDSX: resolveDSX,
          elementProvider: elementProvider,
          intlMessageResolver: intlMessageResolver);
    } else {
      return element;
    }
  } else {
    return asElement ? element : DOMTemplateVariable.valueToString(element);
  }
}