copyWith method

LuckyImageRequest copyWith({
  1. LuckyImageSlot? slot,
  2. LuckyImage? image,
  3. ImageProvider<Object>? provider,
  4. double? decodeLogicalWidth,
  5. double? decodeLogicalHeight,
})

返回只替换指定字段的副本;参数为 null 时保留原值。

例如 request.copyWith(provider: fallback) 保留槽位并替换实际 provider。

Implementation

LuckyImageRequest copyWith(
        {LuckyImageSlot? slot,
        LuckyImage? image,
        ImageProvider<Object>? provider,
        double? decodeLogicalWidth,
        double? decodeLogicalHeight}) =>
    LuckyImageRequest(
        slot: slot ?? this.slot,
        image: image ?? this.image,
        provider: provider ?? this.provider,
        decodeLogicalWidth: decodeLogicalWidth ?? this.decodeLogicalWidth,
        decodeLogicalHeight: decodeLogicalHeight ?? this.decodeLogicalHeight);