copyWith method

Marker copyWith({
  1. Widget? child,
  2. Widget? icon,
  3. MarkerPosition? position,
  4. VoidCallback? onTap,
  5. MarkerIconAlignment? iconAlignment,
  6. double? maxWidth,
})

Creates a copy of this Marker with the given fields replaced with new values.

This method is useful when you need to create a new marker based on an existing one with slight modifications.

Implementation

Marker copyWith({
  Widget? child,
  Widget? icon,
  MarkerPosition? position,
  VoidCallback? onTap,
  MarkerIconAlignment? iconAlignment,
  double? maxWidth,
}) {
  return Marker(
    child: child ?? this.child,
    icon: icon ?? this.icon,
    onTap: onTap ?? this.onTap,
    iconAlignment: iconAlignment ?? this.iconAlignment,
    position: position ?? this.position,
    maxWidth: maxWidth ?? this.maxWidth,
  );
}