Skip to content

dart fix doesn't work on pub dev package #52233

Closed
@chunhtai

Description

@chunhtai

Step to reproduce:

  1. do a Flutter create
  2. in main.dart, use the following code
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';

void main() {
  runApp(
    MaterialApp.router(
      routerConfig: GoRouter(
        routes: [GoRoute(
          name: 'home',
          path: '/',
          redirect: (context, state) {
            print('named lcation ${state.queryParams['abc']}');
            return null;
          },
          builder: (_, state) {
            return Text('${state.fullPath}');
          }
        )]
      ),
    ),
  );
}
  1. in pubspec.yaml, adds the following dependecies
go_router: ^7.0.0
  1. run dart fix --apply

expected result:

The state.queryParams['abc'] should be replaced with state.queryParameters['abc']

actual result:

nothing happens

The fix_data for this entry is in https://github.com/flutter/packages/blob/c3f4c46bbbf1d5d8ad980850aacc82955d187b64/packages/go_router/lib/fix_data.yaml#L109

Note: if in step 3 you replace go_router with path dependency and do a flutter pub get again, dart fix work as expected

 go_router:
   path: /Users/chtai/git/packages/packages/go_router/

Metadata

Metadata

Assignees

Labels

P2A bug or feature request we're likely to work ondevexp-data-driven-fixesIssues with the analysis server's support for data-driven fixesdevexp-serverIssues related to some aspect of the analysis serverlegacy-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