Closed shinayser closed 4 years ago
Could you use quiver
s Optional
class for this as well?
I disagree with Quiver suggestion. A boolean should be more than enough and no need for other external library. More dependencies increases the chances of dependency clash in build time.
OK. I'm not too familiar, what is Darts declaration of a "nullable" value then look like in the future? Something like String? x
(so x
may be null?).
If so, would your code snippet look like this:
DataField<String?>("errorMessage", required: false),
Yes, exactly like that. But since the NNBD will only come in a future version (maybe 3.0?) the lib should provide a retro compatibility.
That's why I suggested the "required" parameter.
I disagree with Quiver's suggestion. A boolean should be more than enough and no need for other external libraries. More dependencies increase the chances of dependency clash in build time.
Yes, this makes sense. I will add this in the next update.
Currently the generator adds "@required" to all DataField objects.
We should have a parameter to indicate if this is really required parameter, like:
This way, the library will be 100% ready for the NNBD next release of Dart language: https://github.com/dart-lang/language/issues/110