ace nits and warning cleanup

- switch to `session.doc.setValue()` when replacing changed file contents - this preserves the undo stack (as per https://github.com/dart-lang/chromedeveditor/issues/1698)
- fix a checked mode issue in ace.dart
- address an analysis warning

@ussuri, @umop 
Definitely more idiomatic. The one I came up with was empirically found by starting at the Ace code, as I couldn't find any pointers online.