getTypeImport function
Returns the import URL for type
.
Implementation
String getTypeImport(DartType type) {
var aliasElement = type.alias?.element;
if (aliasElement != null) {
return normalizeUrl(aliasElement.library.source.uri).toString();
}
if (type is DynamicType) {
return 'dart:core';
}
if (type is InterfaceType) {
return normalizeUrl(type.element.library.source.uri).toString();
}
throw UnimplementedError('(${type.runtimeType}) $type');
}