From db5132ee47a7465372ceb399789915becb1841df Mon Sep 17 00:00:00 2001 From: Adair Date: Sat, 23 Aug 2025 18:45:36 +0200 Subject: [PATCH 1/2] all DateFormat constructors require locale to be a nullable string --- pkgs/intl/lib/src/intl/date_format.dart | 84 ++++++++++++------------- 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/pkgs/intl/lib/src/intl/date_format.dart b/pkgs/intl/lib/src/intl/date_format.dart index ad5f308f7..c13c020e4 100644 --- a/pkgs/intl/lib/src/intl/date_format.dart +++ b/pkgs/intl/lib/src/intl/date_format.dart @@ -523,60 +523,60 @@ class DateFormat { /// /// If the optional [locale] is omitted, the format will be created using the /// default locale in [Intl.systemLocale]. - DateFormat.d([locale]) : this('d', locale); - DateFormat.E([locale]) : this('E', locale); - DateFormat.EEEE([locale]) : this('EEEE', locale); - DateFormat.EEEEE([locale]) : this('EEEEE', locale); - DateFormat.LLL([locale]) : this('LLL', locale); - DateFormat.LLLL([locale]) : this('LLLL', locale); - DateFormat.M([locale]) : this('M', locale); - DateFormat.Md([locale]) : this('Md', locale); - DateFormat.MEd([locale]) : this('MEd', locale); - DateFormat.MMM([locale]) : this('MMM', locale); - DateFormat.MMMd([locale]) : this('MMMd', locale); - DateFormat.MMMEd([locale]) : this('MMMEd', locale); - DateFormat.MMMM([locale]) : this('MMMM', locale); - DateFormat.MMMMd([locale]) : this('MMMMd', locale); - DateFormat.MMMMEEEEd([locale]) : this('MMMMEEEEd', locale); - DateFormat.QQQ([locale]) : this('QQQ', locale); - DateFormat.QQQQ([locale]) : this('QQQQ', locale); - DateFormat.y([locale]) : this('y', locale); - DateFormat.yM([locale]) : this('yM', locale); - DateFormat.yMd([locale]) : this('yMd', locale); - DateFormat.yMEd([locale]) : this('yMEd', locale); - DateFormat.yMMM([locale]) : this('yMMM', locale); - DateFormat.yMMMd([locale]) : this('yMMMd', locale); - DateFormat.yMMMEd([locale]) : this('yMMMEd', locale); - DateFormat.yMMMM([locale]) : this('yMMMM', locale); - DateFormat.yMMMMd([locale]) : this('yMMMMd', locale); - DateFormat.yMMMMEEEEd([locale]) : this('yMMMMEEEEd', locale); - DateFormat.yQQQ([locale]) : this('yQQQ', locale); - DateFormat.yQQQQ([locale]) : this('yQQQQ', locale); - DateFormat.H([locale]) : this('H', locale); - DateFormat.Hm([locale]) : this('Hm', locale); - DateFormat.Hms([locale]) : this('Hms', locale); - DateFormat.j([locale]) : this('j', locale); - DateFormat.jm([locale]) : this('jm', locale); - DateFormat.jms([locale]) : this('jms', locale); + DateFormat.d([String? locale]) : this('d', locale); + DateFormat.E([String? locale]) : this('E', locale); + DateFormat.EEEE([String? locale]) : this('EEEE', locale); + DateFormat.EEEEE([String? locale]) : this('EEEEE', locale); + DateFormat.LLL([String? locale]) : this('LLL', locale); + DateFormat.LLLL([String? locale]) : this('LLLL', locale); + DateFormat.M([String? locale]) : this('M', locale); + DateFormat.Md([String? locale]) : this('Md', locale); + DateFormat.MEd([String? locale]) : this('MEd', locale); + DateFormat.MMM([String? locale]) : this('MMM', locale); + DateFormat.MMMd([String? locale]) : this('MMMd', locale); + DateFormat.MMMEd([String? locale]) : this('MMMEd', locale); + DateFormat.MMMM([String? locale]) : this('MMMM', locale); + DateFormat.MMMMd([String? locale]) : this('MMMMd', locale); + DateFormat.MMMMEEEEd([String? locale]) : this('MMMMEEEEd', locale); + DateFormat.QQQ([String? locale]) : this('QQQ', locale); + DateFormat.QQQQ([String? locale]) : this('QQQQ', locale); + DateFormat.y([String? locale]) : this('y', locale); + DateFormat.yM([String? locale]) : this('yM', locale); + DateFormat.yMd([String? locale]) : this('yMd', locale); + DateFormat.yMEd([String? locale]) : this('yMEd', locale); + DateFormat.yMMM([String? locale]) : this('yMMM', locale); + DateFormat.yMMMd([String? locale]) : this('yMMMd', locale); + DateFormat.yMMMEd([String? locale]) : this('yMMMEd', locale); + DateFormat.yMMMM([String? locale]) : this('yMMMM', locale); + DateFormat.yMMMMd([String? locale]) : this('yMMMMd', locale); + DateFormat.yMMMMEEEEd([String? locale]) : this('yMMMMEEEEd', locale); + DateFormat.yQQQ([String? locale]) : this('yQQQ', locale); + DateFormat.yQQQQ([String? locale]) : this('yQQQQ', locale); + DateFormat.H([String? locale]) : this('H', locale); + DateFormat.Hm([String? locale]) : this('Hm', locale); + DateFormat.Hms([String? locale]) : this('Hms', locale); + DateFormat.j([String? locale]) : this('j', locale); + DateFormat.jm([String? locale]) : this('jm', locale); + DateFormat.jms([String? locale]) : this('jms', locale); /// NOT YET IMPLEMENTED. // TODO(https://github.com/dart-lang/intl/issues/74) - DateFormat.jmv([locale]) : this('jmv', locale); + DateFormat.jmv([String? locale]) : this('jmv', locale); /// NOT YET IMPLEMENTED. // TODO(https://github.com/dart-lang/intl/issues/74) - DateFormat.jmz([locale]) : this('jmz', locale); + DateFormat.jmz([String? locale]) : this('jmz', locale); /// NOT YET IMPLEMENTED. // TODO(https://github.com/dart-lang/intl/issues/74) - DateFormat.jv([locale]) : this('jv', locale); + DateFormat.jv([String? locale]) : this('jv', locale); /// NOT YET IMPLEMENTED. // TODO(https://github.com/dart-lang/intl/issues/74) - DateFormat.jz([locale]) : this('jz', locale); - DateFormat.m([locale]) : this('m', locale); - DateFormat.ms([locale]) : this('ms', locale); - DateFormat.s([locale]) : this('s', locale); + DateFormat.jz([String? locale]) : this('jz', locale); + DateFormat.m([String? locale]) : this('m', locale); + DateFormat.ms([String? locale]) : this('ms', locale); + DateFormat.s([String? locale]) : this('s', locale); /// The 'add_*' methods append a particular skeleton to the format, or set /// it as the only format if none was previously set. These are primarily From e016ac28ec704ffe4633d9470914422524a58c85 Mon Sep 17 00:00:00 2001 From: Adair Date: Sun, 31 Aug 2025 09:58:50 +0200 Subject: [PATCH 2/2] changelog entry --- pkgs/intl/CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/intl/CHANGELOG.md b/pkgs/intl/CHANGELOG.md index 529399ea0..e1a9bcc6f 100644 --- a/pkgs/intl/CHANGELOG.md +++ b/pkgs/intl/CHANGELOG.md @@ -5,6 +5,8 @@ * Fix parsing of locale strings containing script codes in `verifiedLocale`. For example, `zh-Hans-CN` would have been previously parsed as `zh`, but is now parsed as `zh_CN`. + * Typed all DateFormat constructors as requiring a String? locale instead of a dynamic, + as it would throw with any other type ## 0.20.2 * Remove the dependency on `package:http`.