See dart-lang/sdk#41671.
It's easier to highlight code with a trailing semicolon to evaluate, but currently you get an error because this is a statement and not an expression. There should be no negative effects from trimming any trailing semicolon, but it will reduce the chance of the user getting an error.