copyWith method Null safety

ModuleConfig copyWith(
  1. {bool? isAbstract,
  2. bool? isModuleMethod,
  3. ImportableType? module,
  4. String? initializerName}
)

Implementation

ModuleConfig copyWith({
  bool? isAbstract,
  bool? isModuleMethod,
  ImportableType? module,
  String? initializerName,
}) {
  if ((isAbstract == null || identical(isAbstract, this.isAbstract)) &&
      (isModuleMethod == null || identical(isModuleMethod, this.isMethod)) &&
      (module == null || identical(module, this.type)) &&
      (initializerName == null ||
          identical(initializerName, this.initializerName))) {
    return this;
  }

  return ModuleConfig(
    isAbstract: isAbstract ?? this.isAbstract,
    isMethod: isModuleMethod ?? this.isMethod,
    type: module ?? this.type,
    initializerName: initializerName ?? this.initializerName,
  );
}