misc improvements

see commit comments for details
The same guide also advises to add types for public API, see https://www.dartlang.org/articles/style-guide/#prefer-providing-type-annotations-on-public-apis. In the end it's just a matter of personal pref.

If you prefer to remove `dynamic` everywhere, I can update the PR.