copyWith method

CapsuleConfig copyWith({
  1. List<CapsulePrize>? prizes,
  2. List<int>? capsules,
  3. int? capsulesPerPrize,
  4. CapsuleOptions? options,
  5. CapsuleStyle? style,
})

返回替换非空参数的副本,例如 value.copyWith() 保留全部字段。

Implementation

CapsuleConfig copyWith(
        {List<CapsulePrize>? prizes,
        List<int>? capsules,
        int? capsulesPerPrize,
        CapsuleOptions? options,
        CapsuleStyle? style}) =>
    CapsuleConfig(
        prizes: prizes ?? this.prizes,
        capsules: capsules ?? this.capsules,
        capsulesPerPrize: capsulesPerPrize ?? this.capsulesPerPrize,
        options: options ?? this.options,
        style: style ?? this.style);