Onboard to Dart null safety#11
Conversation
In this commit we onboard date_calendar to Dart null safety. This will allow other Flutter projects and Dart packages that depend on date_calendar to themselves onboard to Dart null safety. For more information please see [1]. Unfortunately I had to relax one of the analysis options, since I used casting to get out of some errors. Tested by running `flutter analyze` and `flutter test`. [1] https://dart.dev/null-safety
| class GregorianCalendar implements Calendar { | ||
| /// Setting any of these to null treats them as 1 or 0 (year) | ||
| GregorianCalendar(int year, [int month = 1, int day = 1]) { | ||
| GregorianCalendar(this._year, [int? month = 1, int? day = 1]) { |
There was a problem hiding this comment.
I think it'd be better to just make these non-null.
There was a problem hiding this comment.
I agree, for this constructor despite the comment on line 50 Setting any of these to null treats them as 1 or 0 (year) you should assume these are non-null.
dnfield
left a comment
There was a problem hiding this comment.
I've started looking through this, and I have a number of comments along the lines of "this should probably be non-null."
If you're interested in working through that with me, I'm happy to do so, though it may be faster for me to just migrate this library myself :). Let me know.
|
I apologize for my late reply...I haven't collaborated on GitHub in a long time.
I don't mind either way. This library is crucial to a Flutter app I made for my wife so I feel a sense of gratitude to you. I don't need credit for this pull request, but if I can help you in any way let me know. If it's faster for you to migrate it go for it! |
In this commit we onboard date_calendar to Dart null safety. This will
allow other Flutter projects and Dart packages that depend on
date_calendar to themselves onboard to Dart null safety.
For more information please see [1].
Unfortunately I had to relax one of the analysis options, since I used
casting to get out of some errors.
Tested by running
flutter analyzeandflutter test.[1] https://dart.dev/null-safety