Very good point. Changed to throw StateError.

This time I tried it by adding a "main" and verifying with dart and "dart -c". I still can't think of a way to actually test in a test, unfortunately.