Fixing `Target dart2js failed: Exception: Warning: The 'dart2js' entrypoint script is deprecated, please use 'dart compile js' instead`

This morning, my app started throwing this warning when running flutter build web.

Some people on StackOverflow recomment to run flutter clean and flutter build, but it seems like this issue requires a Flutter upgrade. See this ticket and this related PR.

So I ran flutter upgrade and ran the compilation again, and it compiled successfully.