# Migration guide for RouteSettings copyWith

> Removal of RouteSettings copyWith and how to migrate




:::important
These breaking change docs are accurate, as of the release
under which they are published. Over time, the
workarounds described here might become inaccurate.
We don't, in general, keep these breaking change docs up
to date as of each release.

这些破坏性改动文档的准确性仅限于其发布时对应的版本。
随着时间的推移，文档中描述的方案可能会逐渐失效。
通常情况下，我们不会在每次发布新版本时都对这些文档进行同步更新。

The [breaking change index file](/release/breaking-changes)
lists the docs created for each release.

[破坏性改动列表](/release/breaking-changes) 
列出了每个版本的文档。

:::


## Summary

The `RouteSettings.copyWith` method is removed, and apps that use
it need to use the constructor to create a new `RouteSettings`
instance instead.

## Context

With the introduction of the [`Page`][] class,
the `RouteSettings.copyWith` was no longer a viable API.

## Description of change

`RouteSettings.copyWith` was removed

## Migration guide

Code before migration:

```dart
RouteSettings newSettings = oldSettings.copyWith(name: 'new name');
```

Code after migration:

```dart
RouteSettings newSettings = RouteSettings(name: 'new name', arguments: oldSettings.arguments);
```

## Timeline

Landed in version: 3.5.0-9.0.pre-137-gc6f6095acd<br>
In stable release: 3.7

## References

Relevant PRs:

* [PR 113860][]: Removes RouteSetting.copyWith.

[PR 113860]: https://github.com/flutter/flutter/pull/113860
[`Page`]: https://api.flutter-io.cn/flutter/widgets/Page-class.html

