fromString static method
- String type
Converts a string representation to the corresponding primitive type.
Parameters:
type
: String representation ("int" or "float")
Returns: The corresponding PrimitiveTypes enum value
Throws:
- Exception if the type string is not recognized
Implementation
static PrimitiveTypes fromString(String type) {
switch (type) {
case "int":
return PrimitiveTypes.int;
case "float":
return PrimitiveTypes.float;
default:
throw Exception("Unknown type: $type");
}
}