createInstance static method
Creates an instance of an object type specified by its name and library where it is defined.
name
an object type name.library
a library (module) where object type is defined.args
arguments for the object constructor. Returns the created object instance.
See getType See createInstanceByType
Implementation
static dynamic createInstance(String name, String? library, List args) {
var type = TypeReflector.getType(name, library);
if (type == null) {
throw NotFoundException(null, 'TYPE_NOT_FOUND',
'Type ' + name + ',' + library.toString() + ' was not found')
.withDetails('type', name)
.withDetails('library', library);
}
return TypeReflector.createInstanceByType(type, args);
}