(Speculative) fix for https://github.com/flutter/flutter/issues/144238. @zanderso Could you review from a CLI angle? I realize this code is not great, but could I do something better here?