asType method
Sets the type of a value. If a parser is provided, calls the function
with the value and type and returns the result if any, otherwise returns
this
Implementation
KdlValue asType(String type, [KdlTypeParser<KdlValue>? parser]) {
if (parser == null) {
this.type = type;
return this;
}
var result = parser(this, type);
if (result == null) return asType(type);
return result;
}