Skip to content

prefer_const_constructors false positives in Flutter. #57615

@pq

Description

@pq

In the Flutter repo, prefer_const_constructors gives us a bunch of false positives (119). For example, in dart_picker.dart:

    final Widget actions = new ButtonTheme.bar(
      child: new ButtonBar(
        children: <Widget>[
          new FlatButton(
            child: const Text('CANCEL'),
            onPressed: _handleCancel,
          ),
          new FlatButton(
            child: const Text('OK'),
            onPressed: _handleOk,
          ),
        ],
      ),
    );

we report prefer_const_constructors on new ButtonBar, and then on the list of children: and then for onPressed: which cannot be const.

cc @ a14n @bwilkerson

Metadata

Metadata

Assignees

No one assigned

    Labels

    customer-flutterdevexp-linterIssues with the analyzer's support for the linter packagelegacy-area-analyzerUse area-devexp instead.type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions