Let's make this a bit more efficient by switching imports to be a set of strings instead of a set of paths, then you can use 'contains' here. 
``` dart
var imports = info.usedComponents.keys.map(
    (c) => ....toString)).toSet();
var uniqueImports = codeInfo.directives.where(
    (d) => !imports.contains(d.uri))
for (var directive in uniqueImports) {
  printer.add(...);
}
```

Actually, thinking more about, I believe we need to also check that the prefix is null, that the label is an import, and we might even need to combine show/hide directives to do the right thing...

I think we can start by handling things without the show/hide, for now. For instance something among these lines:

``` dart
var imports = info.usedComponents.keys.map(
    (c) => ....toStrnig)).toSet();
var uniqueImports = codeInfo.directives.where(
    (d) => d.prefix == null && !imports.contains(d.uri) && d.label == 'import' && d.show == null && d.hide == null)
for (var directive in uniqueImports) {
  printer.add(...);
}
```