Dart/Flutter Web unit testing errors: Error: Not found: 'dart:html'
I had a similar issue while developing for a mobile app, but it turned out that I imported the package dart.html accidentally. I just removed it and I was able to run the program.
Since you are running flutter tests for web that use the dart:html package you must target the correct platform.
flutter test --platform chrome
It can happen when you try to import something like @required. Then flutter will accidentally put import dart.html
above the code. Just remove that from the code and then you will fix your issue.