fixes to a dart analysis regression

Fixes an NPE, a cast exception, and a timing issue with dart analysis.

@umop
We were removing the completer, but we should have been removing the project.