copyWith method
Copies this instance, allowing fields overwrite.
conflictingEntityTypes
informs the Types to remove fromlazyEntityTypes
andeagerEntityTypes
.
Implementation
EntityResolutionRules copyWith({
bool? allowEntityFetch,
bool? allowReadFile,
List<Type>? lazyEntityTypes,
List<Type>? eagerEntityTypes,
bool? allLazy,
bool? allEager,
bool? mergeTolerant,
List<Type>? conflictingEntityTypes,
}) {
lazyEntityTypes ??= this.lazyEntityTypes;
eagerEntityTypes ??= this.eagerEntityTypes;
if (conflictingEntityTypes != null && conflictingEntityTypes.isNotEmpty) {
lazyEntityTypes = lazyEntityTypes.without(conflictingEntityTypes);
eagerEntityTypes = eagerEntityTypes.without(conflictingEntityTypes);
}
lazyEntityTypes = lazyEntityTypes.nullIfEmpty();
eagerEntityTypes = eagerEntityTypes.nullIfEmpty();
var resolutionRules = EntityResolutionRules(
allowEntityFetch: allowEntityFetch ?? _allowEntityFetch,
allowReadFile: allowReadFile ?? this.allowReadFile,
lazyEntityTypes: lazyEntityTypes,
eagerEntityTypes: eagerEntityTypes,
allLazy: allLazy ?? this.allLazy,
allEager: allEager ?? this.allEager,
mergeTolerant: mergeTolerant ?? this.mergeTolerant,
);
return resolutionRules.isInnocuous ? innocuous : resolutionRules;
}