Skip to content

Commit cfd7a7c

Browse files
authored
[go_router] Use library prefix for meta (#9434)
We plan to export the `internal` attribute from `package:flutter/foundation.dart`. Currently, `go_router` has files that import both `package:meta/meta.dart` and `package:flutter/foundation.dart`. This causes [lint failures](https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8712222978061136193/+/u/run_test.dart_for_flutter_plugins_shard_and_subshard_analyze/stdout) when `foundation` exports `internal`: ``` info - lib/src/match.dart:12:8 - The import of 'package:meta/meta.dart' is unnecessary because all of the used elements are also provided by the import of 'package:flutter/foundation.dart'. Try removing the import directive. - unnecessary_import info - lib/src/route.dart:10:8 - The import of 'package:meta/meta.dart' is unnecessary because all of the used elements are also provided by the import of 'package:flutter/foundation.dart'. Try removing the import directive. - unnecessary_import ``` This updates go_router to use a library prefix for `package:meta` in affected files to make the lints happy. This change is a refactoring and does not affect semantics and is exempt from the test, version change, and CHANGELOG policies. Part of flutter/flutter#167668 ## Pre-Review Checklist [^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.
1 parent 2a7df7a commit cfd7a7c

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

packages/go_router/lib/src/match.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import 'package:collection/collection.dart';
99
import 'package:flutter/foundation.dart';
1010
import 'package:flutter/widgets.dart';
1111
import 'package:logging/logging.dart';
12-
import 'package:meta/meta.dart';
12+
import 'package:meta/meta.dart' as meta;
1313

1414
import 'configuration.dart';
1515
import 'logging.dart';
@@ -402,7 +402,7 @@ class ShellRouteMatch extends RouteMatchBase {
402402
///
403403
/// This is typically used when pushing or popping [RouteMatchBase] from
404404
/// [RouteMatchList].
405-
@internal
405+
@meta.internal
406406
ShellRouteMatch copyWith({
407407
required List<RouteMatchBase>? matches,
408408
}) {
@@ -766,7 +766,7 @@ class RouteMatchList with Diagnosticable {
766766
/// returns false.
767767
///
768768
/// This method visit recursively into shell route matches.
769-
@internal
769+
@meta.internal
770770
void visitRouteMatches(RouteMatchVisitor visitor) {
771771
_visitRouteMatches(matches, visitor);
772772
}
@@ -786,7 +786,7 @@ class RouteMatchList with Diagnosticable {
786786
}
787787

788788
/// Create a new [RouteMatchList] with given parameter replaced.
789-
@internal
789+
@meta.internal
790790
RouteMatchList copyWith({
791791
List<RouteMatchBase>? matches,
792792
Uri? uri,
@@ -841,7 +841,7 @@ class RouteMatchList with Diagnosticable {
841841
/// suitable for using with [StandardMessageCodec].
842842
///
843843
/// The primary use of this class is for state restoration and browser history.
844-
@internal
844+
@meta.internal
845845
class RouteMatchListCodec extends Codec<RouteMatchList, Map<Object?, Object?>> {
846846
/// Creates a new [RouteMatchListCodec] object.
847847
RouteMatchListCodec(RouteConfiguration configuration)

packages/go_router/lib/src/route.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import 'dart:async';
77
import 'package:collection/collection.dart';
88
import 'package:flutter/foundation.dart';
99
import 'package:flutter/widgets.dart';
10-
import 'package:meta/meta.dart';
10+
import 'package:meta/meta.dart' as meta;
1111

1212
import 'configuration.dart';
1313
import 'match.dart';
@@ -459,7 +459,7 @@ class GoRoute extends RouteBase {
459459
extractPathParameters(pathParameters, match);
460460

461461
/// The path parameters in this route.
462-
@internal
462+
@meta.internal
463463
final List<String> pathParameters = <String>[];
464464

465465
@override

0 commit comments

Comments
 (0)