To improve clarity and reduce ambiguity around weekday handling, we propose the following changes:
- Refactor
RecurrenceSettings.weekdays
Currently, RecurrenceSettings accepts weekdays as a List<int>, which requires users to manually map Dart’s DateTime.weekday values to the package’s internal weekday representation. This can be confusing and may lead to subtle bugs.
We propose updating this API to accept List<WeekDays>, where WeekDays is the enum defined by this package. This will make the API more explicit, easier to understand, and safer to use. Although this is a breaking change, it will surface compile-time errors during upgrades, prompting users to make the necessary updates explicitly and avoiding silent runtime issues.
- Expose a
DateTime extension for WeekDays
To make the migration and general usage easier, we will expose an extension on DateTime that allows users to directly obtain the corresponding WeekDays value from a DateTime instance. This will remove the need for manual mapping and provide a more ergonomic and consistent developer experience.
Overall, these changes aim to improve API correctness, usability, and long-term maintainability while minimizing the risk of unexpected behavior.
To improve clarity and reduce ambiguity around weekday handling, we propose the following changes:
RecurrenceSettings.weekdaysCurrently,
RecurrenceSettingsaccepts weekdays as aList<int>, which requires users to manually map Dart’s DateTime.weekday values to the package’s internal weekday representation. This can be confusing and may lead to subtle bugs.We propose updating this API to accept
List<WeekDays>, where WeekDays is the enum defined by this package. This will make the API more explicit, easier to understand, and safer to use. Although this is a breaking change, it will surface compile-time errors during upgrades, prompting users to make the necessary updates explicitly and avoiding silent runtime issues.DateTimeextension forWeekDaysTo make the migration and general usage easier, we will expose an extension on
DateTimethat allows users to directly obtain the correspondingWeekDaysvalue from aDateTimeinstance. This will remove the need for manual mapping and provide a more ergonomic and consistent developer experience.Overall, these changes aim to improve API correctness, usability, and long-term maintainability while minimizing the risk of unexpected behavior.