withTracked method
Returns copy of settings with reduced ignore lists.
Items in classes
will be removed from all ignore lists.
Implementation
@useResult
LeakTesting withTracked({
List<String> experimentalNotGCed = const [],
List<String> notDisposed = const [],
List<String> classes = const [],
bool experimentalAllNotGCed = false,
bool allNotDisposed = false,
bool createdByTestHelpers = false,
}) {
var newNotGCed = ignoredLeaks.experimentalNotGCed
.track([...experimentalNotGCed, ...classes]);
if (experimentalAllNotGCed) {
newNotGCed = newNotGCed.copyWith(ignoreAll: false);
}
var newNotDisposed =
ignoredLeaks.notDisposed.track([...notDisposed, ...classes]);
if (allNotDisposed) {
newNotDisposed = newNotDisposed.copyWith(ignoreAll: false);
}
final result = copyWith(
ignoredLeaks: IgnoredLeaks(
experimentalNotGCed: newNotGCed,
notDisposed: newNotDisposed,
createdByTestHelpers:
ignoredLeaks.createdByTestHelpers && !createdByTestHelpers,
testHelperExceptions: ignoredLeaks.testHelperExceptions,
),
);
return result;
}