copyWith method
AutoRoute
copyWith({
- RouteType? type,
- String? name,
- String? path,
- bool? usesPathAsKey,
- List<
AutoRouteGuard> ? guards, - bool? fullMatch,
- Map<
String, dynamic> ? meta, - bool? maintainState,
- bool? fullscreenDialog,
- List<
AutoRoute> ? children, - TitleBuilder? title,
- RestorationIdBuilder? restorationId,
- bool? keepHistory,
- bool? initial,
- bool? allowSnapshotting,
A simplified copyWith
Returns a new AutoRoute instance with the provided details overriding.
Implementation
AutoRoute copyWith({
RouteType? type,
String? name,
String? path,
bool? usesPathAsKey,
List<AutoRouteGuard>? guards,
bool? fullMatch,
Map<String, dynamic>? meta,
bool? maintainState,
bool? fullscreenDialog,
List<AutoRoute>? children,
TitleBuilder? title,
RestorationIdBuilder? restorationId,
bool? keepHistory,
bool? initial,
bool? allowSnapshotting,
}) {
return AutoRoute._change(
type: type ?? this.type,
name: name ?? this.name,
path: path ?? this.path,
usesPathAsKey: usesPathAsKey ?? this.usesPathAsKey,
guards: guards ?? List.from(this.guards),
//copy
fullMatch: fullMatch ?? this.fullMatch,
meta: meta ?? this.meta,
maintainState: maintainState ?? this.maintainState,
fullscreenDialog: fullscreenDialog ?? this.fullscreenDialog,
children: children != null
? (children.isEmpty ? null : RouteCollection.fromList(children))
: this.children,
//copy
title: title ?? this.title,
restorationId: restorationId ?? this.restorationId,
keepHistory: keepHistory ?? this.keepHistory,
initial: initial ?? this.initial,
allowSnapshotting: allowSnapshotting ?? this.allowSnapshotting,
);
}