copyWith method Null safety

SfRangeValues copyWith(
  1. {dynamic start,
  2. dynamic end}
)

Implementation

SfRangeValues copyWith({dynamic start, dynamic end}) {
  if (start != null &&
      start.runtimeType == num &&
      this.end.runtimeType == DateTime) {
    // ignore: avoid_as
    final double value = start as double;
    return SfRangeValues(
        DateTime.fromMillisecondsSinceEpoch(value.toInt()), end ?? this.end);
  } else if (end != null &&
      end.runtimeType == num &&
      this.start.runtimeType == DateTime) {
    // ignore: avoid_as
    final double value = end as double;
    return SfRangeValues(start ?? this.start,
        DateTime.fromMillisecondsSinceEpoch(value.toInt()));
  }

  return SfRangeValues(start ?? this.start, end ?? this.end);
}