Skip to content

Allow consructor initializers to access fields initialized from previous initializers #4458

@rrousselGit

Description

@rrousselGit

TL;DR support:

class Foo {
  Foo()
      : a = DateTime.now(),
        b = 'Hello $a'; // < initialize b from a

  final DateTime a;
  final String b;
}

The idea is to have the order of initializers matter.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureProposed language feature that solves one or more problems

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions