Skip to content

Compiler should try to make everything const #1410

Closed
@feinstein

Description

@feinstein

I mainly use Dart for Flutter and declaring Widgets as const brings performance improvements. On the other hand it's boring to type const all the time, or verifying which constructors are const, or even having to fix a constructor call that just got broken because it was declared as const and now can't be evaluated at compile time.

A linter warning helps to remember to use const, but actually using them isn't much comfortable.

It would be amazing if the compiler could automatically understand what can be promoted to const and optimize the code as const behind the scenes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhanced-constRequests or proposals about enhanced constant expressionsfeatureProposed 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