Skip to content

Fix stale ignore: prefer_const_constructors from flutter/packages #128141

Description

@stuartmorgan-g

We have some TODOs related to ignores in flutter/packages related to making classes const which can now be cleaned up by addressing the TODO (adding const, and removing the ignore). They can be found by searching for:

// TODO(goderbauer): Make this const when this package requires Flutter 3.8 or later.

Any package we make this change in will need to be updated to have a minimum Flutter version of 3.10 (the first stable after 3.8, where the constructors became const).

Activity

  1. SpruceVedant commented on Jun 3, 2023

    @SpruceVedant

    We have some ignores in flutter/packages related to making classes const which can now be cleaned up. They can be found by searching for:

    // TODO(goderbauer): Make this const when this package requires Flutter 3.8 or later.
    

    (In some cases we may need to update minimum Flutter versions in packages while changing this.)

    Hey, I have searched for the specific comment mentioned in the issue description,
    // TODO(goderbauer): Make this const when this package requires Flutter 3.8 or later , but I couldn't locate it in the codebase.

    However I managed to find many instances of :
    // ignore: prefer_const_constructors and // ignore: prefer_const_constructors_in_immutables in flutter/packages and I think these statements are stale and can be cleaned up right, can you verify ?

  2. stuartmorgan-g commented on Jun 3, 2023

    @stuartmorgan-g
    ContributorAuthor

    Hey, I have searched for the specific comment mentioned in the issue description,
    // TODO(goderbauer): Make this const when this package requires Flutter 3.8 or later , but I couldn't locate it in the codebase.

    There are many occurrences.

    However I managed to find many instances of :
    // ignore: prefer_const_constructors and // ignore: prefer_const_constructors_in_immutables in flutter/packages and I think these statements are stale and can be cleaned up right, can you verify ?

    It depends on when and why they were added. You're welcome to investigate them on a case by case basis if you want to, but that's not what this issue is about. This is about the specific case described here.

  3. SpruceVedant commented on Jun 4, 2023

    @SpruceVedant

    Hey, I have searched for the specific comment mentioned in the issue description,
    // TODO(goderbauer): Make this const when this package requires Flutter 3.8 or later , but I couldn't locate it in the codebase.

    There are many occurrences.

    However I managed to find many instances of :
    // ignore: prefer_const_constructors and // ignore: prefer_const_constructors_in_immutables in flutter/packages and I think these statements are stale and can be cleaned up right, can you verify ?

    It depends on when and why they were added. You're welcome to investigate them on a case by case basis if you want to, but that's not what this issue is about. This is about the specific case described here.

    Now I get it , I was searching for it in the wrong place got confused , now I have found all of the instances of
    ignore: prefer_const_constructors in the packages repository, Thank you for clarifying!!

  4. SpruceVedant commented on Jun 5, 2023

    @SpruceVedant

    We have some ignores in flutter/packages related to making classes const which can now be cleaned up. They can be found by searching for:

    // TODO(goderbauer): Make this const when this package requires Flutter 3.8 or later.
    

    so just ignore: prefer_const_constructors needs to be removed or //Todo 's also ?

    (In some cases we may need to update minimum Flutter versions in packages while changing this.)

    can you elaborate regarding updating Flutter versions?

  5. ayinloya commented on Jun 6, 2023

    @ayinloya

    Like the comment mentions, do we add the const to the widget the ignore: prefer_const_constructor is on?

  6. changed the title [-]Remove stale `ignore: prefer_const_constructors` from flutter/packages[/-] [+]Fix stale `ignore: prefer_const_constructors` from flutter/packages[/+] on Jun 6, 2023
  7. stuartmorgan-g commented on Jun 6, 2023

    @stuartmorgan-g
    ContributorAuthor

    I have updated the issue description to clarify what this involves.

    A PR that removes the ignores without addressing the TODO won't pass analysis, and thus won't pass our CI.

  8. ayinloya commented on Jun 6, 2023

    @ayinloya

    Thanks for the clarification

  9. added
    P2Important issues not at the top of the work list
    on Jun 6, 2023
  10. github-actions commented on Jun 22, 2023

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  11. locked as resolved and limited conversation to collaborators on Jun 22, 2023
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

    P2Important issues not at the top of the work listc: contributor-productivityTeam-specific productivity, code health, technical debt.c: tech-debtTechnical debt, code quality, testing, etc.packageflutter/packages repository. See also p: labels.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions