ImageData constructor Null safety

ImageData(
  1. dynamic data_OR_sw,
  2. int sh_OR_sw,
  3. [int? sh]
)

Implementation

factory ImageData(data_OR_sw, int sh_OR_sw, [int? sh]) {
  if ((sh_OR_sw is int) && (data_OR_sw is int) && sh == null) {
    return ImageData._create_1(data_OR_sw, sh_OR_sw);
  }
  if ((sh_OR_sw is int) && (data_OR_sw is Uint8ClampedList) && sh == null) {
    return ImageData._create_2(data_OR_sw, sh_OR_sw);
  }
  if ((sh is int) && (sh_OR_sw is int) && (data_OR_sw is Uint8ClampedList)) {
    return ImageData._create_3(data_OR_sw, sh_OR_sw, sh);
  }
  throw new ArgumentError("Incorrect number or type of arguments");
}