Fix errors caught by dartanalyzer.