convertToString static method
Implementation
static String convertToString(DataType object) {
if (object is PrimitiveDataType) {
return object.nativeTypeName;
} else if (object is CollectionDataType) {
if (object is EmList) {
final elementType = convertToString(object.wrapped);
return '${object.nativeTypeName}<$elementType>${object.nullable ? '?' : ''}';
} else if (object is EmMap) {
final keyType = convertToString(object.wrappedKey);
final valueType = convertToString(object.wrappedValue);
return '${object.nativeTypeName}<$keyType, $valueType>${object.nullable ? '?' : ''}';
} else {
throw 'Unsupported Collection Data Type!';
}
} else if (object is CustomizeDataType) {
return object.dataType;
} else if (object is AsynchronousDataType) {
if (object is EmFuture) {
final elementType = convertToString(object.wrapped);
return '${object.nativeTypeName}<$elementType>${object.nullable ? '?' : ''}';
} else if (object is EmStream) {
final elementType = convertToString(object.wrapped);
return '${object.nativeTypeName}<$elementType>${object.nullable ? '?' : ''}';
} else {
throw 'Unsupported Asynchronous Data Type!';
}
} else if (object is SpecialDataTypes) {
return object.nativeTypeName;
} else if (object is EnumerationDataType) {
return object.nativeTypeName;
} else if (object is EmDateTime) {
return object.nativeTypeName;
} else {
throw 'Unsupported Data Type!';
}
}