quicktype
quicktype copied to clipboard
Removed "@" notation for required fields in dart
Whats inside
Removed "@" notation for required fields in dart
@required is just an annotation that allows analysers let you know that you're missing a named parameter and that's it. so you can still compile the application and possibly get an exception if this named param was not passed.
However sound null-safety was added to dart, and required is now a keyword that needs to be passed to a named parameter so that it doesn't let the compiler run if this parameter has not been passed. It makes your code more strict and safe.
https://dart.dev/null-safety/faq#how-does-required-compare-to-the-new-required-keyword
Also closes #1905
关于Dart空安全问题,不仅仅是要解决这个@的问题,还有其他一堆问题需要解决。我早先已经提交了一个PR给官方了。具体参考:#1904
Regarding the Dart null safety issue, it's not just this @ issue that needs to be addressed, there are a bunch of other issues that need to be addressed. I have submitted a PR to the official earlier. specific reference: #1904
I've merged an equivalent fix. Thank you!