Skip to content

replacedBy won't replace getter with method #50699

@Piinks

Description

@Piinks

Working on a change in flutter/flutter, I deprecated a getter in favor of a new method.

I've tried this a couple of ways now, but the transform has never worked:

I deprecated

@Deprecated('Use tabHasTextAndIconFor...')
bool get tabHasTextAndIcon => ...

/// Replacement
bool tabHasTextAndIconFor(BuildContext context) {...}

with this transform

# Changes made in TBD
  - title: "Migrate to 'tabHasTextAndIconFor'"
    date: 2022-12-12
    element:
      uris: ['material.dart']
      getter: 'tabHasTextAndIcon'
      inClass: 'TabBar'
    changes:
    - kind: 'replacedBy'
      newElement:
        uris: ['material.dart']
        method: 'tabHasTextAndIconFor'
        inClass: 'TabBar'
    - kind: 'addParameter'
      index: 0
        name: 'context'
        style: required_positional
        argumentValue:
          expression: 'context'
          requiredIf: 'true'

And I guess I expected this change:

// Before
tabBar.tabHasTextAndIcon;

// After
tabBar.tabHasTextAndIconFor(context);

But nothing happened.

Is this possible? Or is there another way?

Related: #50698

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2A bug or feature request we're likely to work ondevexp-data-driven-fixesIssues with the analysis server's support for data-driven fixeslegacy-area-analyzerUse area-devexp instead.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions