Skip to content
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

Update outdated mention that factory constructors can return null. #5623

Closed
wants to merge 5 commits into from

Conversation

robsenshemsedin
Copy link

Factory constructors no longer return null with null-safe Dart. Instead, they can be used to return instance of a class or subtypes.

Fixes #5506

@atsansone
Copy link
Contributor

/gcbrun

@dart-github-bot
Copy link
Collaborator

Visit the preview URL for this PR (updated for commit 51b9d7f):

https://dart-dev--pr5623-patch-3-87hjkq54.web.app

@@ -1728,7 +1728,7 @@ void main() {
## Factory constructors

Dart supports factory constructors,
which can return subtypes or even null.
which can return instances of a class or even subtypes.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything is an instance of a class in Dart (even null), so that doesn't say much. But you're exactly right that factory constructors can't return null anymore. That's a good catch. How about:

"which can return an instance of the surrounding class or even a subtype of it."

@atsansone
Copy link
Contributor

Fixed in #5757.

@atsansone atsansone closed this May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update outdated mention that factory constructors can return null
4 participants