Unverified Commit c6f6095a authored by chunhtai's avatar chunhtai Committed by GitHub

Remove RouteSetting.copyWith (#113860)

parent f60b44da
...@@ -537,18 +537,6 @@ class RouteSettings { ...@@ -537,18 +537,6 @@ class RouteSettings {
this.arguments, this.arguments,
}); });
/// Creates a copy of this route settings object with the given fields
/// replaced with the new values.
RouteSettings copyWith({
String? name,
Object? arguments,
}) {
return RouteSettings(
name: name ?? this.name,
arguments: arguments ?? this.arguments,
);
}
/// The name of the route (e.g., "/settings"). /// The name of the route (e.g., "/settings").
/// ///
/// If null, the route is anonymous. /// If null, the route is anonymous.
......
...@@ -116,8 +116,6 @@ void main() { ...@@ -116,8 +116,6 @@ void main() {
testWidgets('Route settings', (WidgetTester tester) async { testWidgets('Route settings', (WidgetTester tester) async {
const RouteSettings settings = RouteSettings(name: 'A'); const RouteSettings settings = RouteSettings(name: 'A');
expect(settings, hasOneLineDescription); expect(settings, hasOneLineDescription);
final RouteSettings settings2 = settings.copyWith(name: 'B');
expect(settings2.name, 'B');
}); });
testWidgets('Route settings arguments', (WidgetTester tester) async { testWidgets('Route settings arguments', (WidgetTester tester) async {
...@@ -127,14 +125,6 @@ void main() { ...@@ -127,14 +125,6 @@ void main() {
final Object arguments = Object(); final Object arguments = Object();
final RouteSettings settings2 = RouteSettings(name: 'A', arguments: arguments); final RouteSettings settings2 = RouteSettings(name: 'A', arguments: arguments);
expect(settings2.arguments, same(arguments)); expect(settings2.arguments, same(arguments));
final RouteSettings settings3 = settings2.copyWith();
expect(settings3.arguments, equals(arguments));
final Object arguments2 = Object();
final RouteSettings settings4 = settings2.copyWith(arguments: arguments2);
expect(settings4.arguments, same(arguments2));
expect(settings4.arguments, isNot(same(arguments)));
}); });
testWidgets('Route management - push, replace, pop sequence', (WidgetTester tester) async { testWidgets('Route management - push, replace, pop sequence', (WidgetTester tester) async {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment