generateConstructor method
Generates code that constructs a representation of the type from an expression
as an XML attribute / XML element / XML text.
An implementation to construct a representation of the type as an XML text could be as simple as:
String generateConstructor(String expression) => 'XmlText($expression)';
Implementation
@override
String generateConstructor(String expression) {
final closureArgument = IterableConstructorGenerator._closureArgument;
final closureResult = _generator.generateConstructor(closureArgument);
final buffer = StringBuffer(expression);
if (closureResult != closureArgument) {
if (_isNullable) {
buffer.write('?');
}
buffer.write('.map(($closureArgument) => $closureResult)');
}
return buffer.toString();
}