0

I want to build a web application bundle for my flutter project by using the command 'flutter build web'. However, I face an error i.e.

Target dart2js failed: Exception: Warning: The 'dart2js' entrypoint script is deprecated, please use 'dart compile js' instead. Error: Cannot run with sound null safety, because the following dependencies don't support null safety: 

I can run the app in debug mode but can't build the web bundle.

2
  • error says there are some packages that they don't support null safety. so you should find those packages and make sure they support null safety. Commented Jun 12, 2022 at 10:04
  • I had done that as well, but it wasn’t working, however when I updated the package that was throwing the error, it worked. Commented Jun 14, 2022 at 17:35

2 Answers 2

1

Apparently one of your packages does not support Null Safety and needs to be removed for your application to work. The error message should tell you which package is affected.

There is no way to continue using it without effort, as it is deprecated and apparently not being developed further. You can fork the package and implement the null safety yourself, which should not be that hard. Or there is already a fork that has implemented it.

Sign up to request clarification or add additional context in comments.

1 Comment

But if I remove the package then one of the functionality would cease to work. Any suggestions?
0

Solved: I updated the package that was the cause of the error, and it works now.

1 Comment

If you had written which package is affected, we could have told you directly.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.