DateTime default value
- Dominant language
- Dart
- Stars
- 4.4k
- Forks
- 449
- PR merge metrics
- No merged PRs in 30d
Description
I'd like to be able to specify `DateTime(0)` as a default value for DateTime objects.
Of course you can't do this because `DateTime(0)` isn't const.
A solution for this would be to specify `true` as the default value, which would actually generate `DateTime(0)` in the adapter.
One solution specifying `true` as the default value, which generates wrong code, but the error raised by the Dart compiler allows you to make the correction manually in the generated file.
It's incredibly bad practice, I know. A _better_ alternative is to have these fields be nullable, and use getters and setters. I don't like this approach because it adds unnecessary layers, but whatever works I guess.
Would it be possible to do this in a timely manner ? If not, I'll go with the nullable fields approach. It just annoys me because I'll then practically be stuck with these nullable fields and their accessors forever.
Thanks !
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.