Debugging in Dart: "required isn't a type"

This is an annoying bug that can occur in Flutter and Dart when you are trying to make certain parameters required. 


Ew. 

Ok, let's try changing the syntax a little bit. 


K, so that's a bit more helpful. 

What's in our pubspec.yaml for the minimum required SDK? 

Oh. Maybe that's why. 

Change the version to >=2.12.0: 


And then run pub get: 



Looks successful. 


And boom! The error is gone. 

Warning: This will cause Dart to be way stricter about type safety, so you might get a zillion other errors in your project. So, the choice of what you want to deal with is up to you. 

I had to add an extra argument to my run configurations: 


And then everything ran smoothly once more. 

Comments

Popular posts from this blog

Unleashing my inner Disney Princess ✩₊˚.⋆☾⋆⁺₊✧ at the 2024 Disney Princesses Half Marathon

The 20-something types of Computer Science majors

The Evenstar