Skip to content

replacedBy not affecting static methods #50698

@Piinks

Description

@Piinks

Working on a change in flutter/flutter, I deprecated a static method 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 preferredSizeFor...')
static double preferredHeightFor(BuildContext context, Size preferredSize) {...}

/// Replacement
Size preferredSizeFor(BuildContext context) {...}

with this transform

  # Changes made in TBD
  - title: "Migrate to 'preferredSizeFor'"
    date: 2022-12-12
    element:
      uris: [' material.dart' ]
      method: 'preferredHeightFor'
      inClass: 'AppBar'
    changes:
    - kind: 'replacedBy'
      newElement:
        uris: ['material.dart']
        method: 'preferredSizeFor'
        inClass: 'AppBar'
    - kind: 'removeParameter'
      index: 1

And I guess I expected this change:

// Before
AppBar.preferredHeightFor(context, preferredSize);

// After
preferredSizeFor(context);

But nothing happened.

The new method is not static, so I know this is not a complete transformation, I was hoping that I could at least get users in the right direction. Is this possible? Or is there another way?

Related: #50699

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3A lower priority bug or feature requestarea-devexpFor issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.type-enhancementA request for a change that isn't a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions