Skip to content

Add a mechanism to check if a late variable is initialised #4196

Closed
@hrajwade96

Description

@hrajwade96

At present there is no way to check if a late variable is actually initialised or not,
Can we add a way to check this?
for example in Kotlin we can check if a lateinit variable is initialised :
Kotlin lateinit variables

If someone can point to where this code needs to be modified I can also work on this PR.

Activity

added
featureProposed language feature that solves one or more problems
on Dec 6, 2024
julemand101

julemand101 commented on Dec 6, 2024

@julemand101

Sounds like a duplicate of: #1028

mateusfccp

mateusfccp commented on Dec 6, 2024

@mateusfccp
Contributor

Sounds like a duplicate of: #1028

This one is closed, I think #3680 is equivalent and is still open.

lrhn

lrhn commented on Dec 6, 2024

@lrhn
Member

I think #1028 is the best fit (and it being closed is a big hint that this is an unlikely feature to happen, at least by itself).

The #3680 does include a ?? operator for late variables, but I'd not expect that operator to be added alone, only if it's part of the change that also adds late parameters. For late variables, you're expected to know whether they're initialized.

But definitely a duplicate of one or the other.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureProposed language feature that solves one or more problemsstate-duplicateThis issue or pull request already exists

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @julemand101@mateusfccp@lrhn@hrajwade96

        Issue actions

          Add a mechanism to check if a late variable is initialised · Issue #4196 · dart-lang/language