Skip to content

Regression: Const constructors don't work for widgets on master #44858

@rrousselGit

Description

@rrousselGit

The title says it all:
On master, const constructors simply do not work anymore for widgets.

Consider the following snippet:

// test/my_test.dart
import 'package:flutter/cupertino.dart';

void main() {
  print(identical(const SizedBox(), const SizedBox()));
  print(identical(const A(), const A()));
}

class A  {
  const A();
}

executed using flutter test test/my_test.dart

This will print:

false
true

when the expected result is:

true
true

This issue happens on the master branch, but not on stable.

Flutter doctor:

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel unknown, v1.11.1-pre.39, on Mac OS X 10.14.5 18F132, locale en-FR)
 
[!] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    ! Some Android licenses not accepted.  To resolve this, run: flutter doctor --android-licenses
[!] Xcode - develop for iOS and macOS (Xcode 11.2.1)
    ✗ CocoaPods not installed.
        CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side.
        Without CocoaPods, plugins will not work on iOS or macOS.
        For more info, see https://flutter.dev/platform-plugins
      To install:
        sudo gem install cocoapods
[✓] Android Studio (version 3.1)
[✓] VS Code (version 1.39.2)
[!] Connected device
    ! No devices available

! Doctor found issues in 3 categories.

Metadata

Metadata

Assignees

No one assigned

    Labels

    a: annoyanceRepeatedly frustrating issues with non-experimental functionalityc: new featureNothing broken; request for a new capabilitytoolAffects the "flutter" command-line tool. See also t: labels.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions