Skip to content

Forbid catchError usage in flutter_tool package #120146

@jmagman

Description

@jmagman

Per #119977 and dart-lang/sdk#51248 using catchError has caused hard-to-track-down runtime crashes when the callback return value is mismatched (even when it "matches" but is more specific) with the future it's called on.

Per #114031 (comment) create a tool test that will fail if catchError is used in the flutter_tools package, and instead suggest then(onError:) be used instead.

An example of a check like this for forbidden imports:

test('no imports of commands/* or test/* in lib/src/*', () {

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.team-toolOwned by Flutter Tool teamtoolAffects the "flutter" command-line tool. See also t: labels.tool-still-validIssues that have been deemed still valid as part of the Flutter Tools issue cleanup initiative.triaged-toolTriaged by Flutter Tool team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions