ConstructorGenerator class abstract

Defines methods for generating constructors for representations of types for example:

class XmlTextConstructorGenerator extends ConstructorGenerator {
  const XmlTextConstructorGenerator();

  @override
  String generateConstructor(String expression) => 'XmlText($expression)';
}

It is recommended to use a ConstructorGenerator in combination with a SerializerGenerator for example:

// Constructs an XML text with a serialized instance of an int type.
buffer.write('final value = ${XmlTextConstructorGenerator().generateConstructor(IntSerializerGenerator().generateSerializer('element'))};');
Implementers

Constructors

ConstructorGenerator()
Constructs a ConstructorGenerator.
const

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

generateConstructor(String expression) String
Generates code that constructs a representation of the type from an expression as an XML attribute / XML element / XML text.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited