-
Notifications
You must be signed in to change notification settings - Fork 58
[package:intl] All DateFormat constructors require locale to be a nullable string #1005
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summary of Changes
Hello @Adair-GA, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request refines the DateFormat constructors within the intl package by explicitly typing the locale argument as a nullable string (String?). This change addresses a previous behavior where passing a non-String? argument would result in an exception, thereby enhancing the robustness and predictability of the API by aligning it with expected null-safe practices.
Highlights
- Type Safety & API Consistency: All DateFormat constructors have been updated to explicitly type the
localeparameter asString?, ensuring that the argument can be a nullable string without throwing an exception.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request correctly updates the named constructors of DateFormat to explicitly type the optional locale parameter as String?. This is a valuable improvement for type safety and aligns with modern Dart practices, especially with null safety. The changes are consistent and well-executed across all relevant constructors. I have no further suggestions, great work!
Package publishing
Documentation at https://github.com/dart-lang/ecosystem/wiki/Publishing-automation. |
PR Health
Breaking changes
|
| Package | Change | Current Version | New Version | Needed Version | Looking good? |
|---|---|---|---|---|---|
| intl | Breaking | 0.20.2 | 0.20.3-wip | 0.21.0 Got "0.20.3-wip" expected >= "0.21.0" (breaking changes) |
This check can be disabled by tagging the PR with skip-breaking-check.
Changelog Entry ✔️
| Package | Changed Files |
|---|
Changes to files need to be accounted for in their respective changelogs.
This check can be disabled by tagging the PR with skip-changelog-check.
Coverage ✔️
| File | Coverage |
|---|---|
| pkgs/intl/lib/src/intl/date_format.dart | 💚 66 % |
This check for test coverage is informational (issues shown here will not fail the PR).
This check can be disabled by tagging the PR with skip-coverage-check.
API leaks ⚠️
The following packages contain symbols visible in the public API, but not exported by the library. Export these symbols or remove them from your publicly visible API.
| Package | Leaked API symbol | Leaking sources |
|---|---|---|
| intl | StringStack | intl/date_format.dart::_DateFormatField::parse::input intl/date_format.dart::_DateFormatField::parseLoose::input intl/date_format.dart::_DateFormatField::parseLiteral::input intl/date_format.dart::_DateFormatField::parseLiteralLoose::input intl/date_format.dart::_DateFormatField::throwFormatException::stack intl/number_parser_base.dart::NumberParserBase::input intl/number_parser_base.dart::NumberParserBase::parseNumber::input |
| intl | DateBuilder | intl/date_format.dart::_DateFormatField::parse::dateFields intl/date_format.dart::_DateFormatField::parseLoose::dateFields |
This check can be disabled by tagging the PR with skip-leaking-check.
License Headers ✔️
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
| Files |
|---|
| no missing headers |
All source files should start with a license header.
This check can be disabled by tagging the PR with skip-license-check.
|
You can ignore the API leaks, that can be fixed in a different PR and not caused by this. For the version, I don't believe this is breaking as the underlying constructor redirection does take a So a changelog entry and you are good to go! |
|
Is it good like that or do I need to change anything? |
|
All good - I will start merging, which is a bit of a complicated process for this package, as the source-of-truth is inside Google. So please be patient :) |
DateFormat constructors now require the locale argument to be a nullable string. Before, if the argument was not a String?, an exception would be thrown (see #14)