getAttributeValue method

  1. @override
String? getAttributeValue([
  1. DOMContext? domContext,
  2. DOMTreeMap? treeMap
])
override

Returns the attribute value.

domContext Optional context, used by DOMGenerator.

Implementation

@override
String? getAttributeValue([DOMContext? domContext, DOMTreeMap? treeMap]) {
  if (domContext == null) {
    return super.getAttributeValue(domContext);
  } else {
    var build = template.build(domContext,
        elementProvider: (q) => treeMap?.queryElement(q,
            domContext: domContext, buildTemplates: true),
        intlMessageResolver: domContext.intlMessageResolver);

    if (build == null) {
      return super.getAttributeValue(domContext);
    } else if (build is String) {
      return build;
    } else if (build is Iterable) {
      var list = build.map((e) => e?.toString()).toList();
      return list.join();
    } else {
      return '$build';
    }
  }
}