findInstanceCreationExpression property
InstanceCreationExpression?
get
findInstanceCreationExpression
Returns the instance creation expression that surrounds this node, if any,
and otherwise null.
This node may be the instance creation expression itself or an (optionally prefixed) identifier that names the constructor.
Implementation
InstanceCreationExpression? get findInstanceCreationExpression {
var node = this;
if (node is ImportPrefixReference) {
node = node.parent;
}
if (node is SimpleIdentifier) {
node = node.parent;
}
if (node is PrefixedIdentifier) {
node = node.parent;
}
if (node is NamedType) {
node = node.parent;
}
if (node is ConstructorName) {
node = node.parent;
}
if (node is InstanceCreationExpression) {
return node;
}
return null;
}