checkModels method
DV-CDC-008 when a destination names a data model that is not among
captured, the class names of every @DVModel(capture: true).
Implementation
void checkModels(Set<String> captured) {
for (final DVCaptureDestination destination in destinations) {
final List<String> strangers = <String>[
for (final String model in destination.models ?? const <String>{})
if (!captured.contains(model)) model,
]..sort();
if (strangers.isEmpty) continue;
throw DVCaptureConfigError(
'DV-CDC-008',
'dartvel.capture.destinations.${destination.name} takes '
'${strangers.join(', ')}, which ${strangers.length == 1 ? 'is' : 'are'} '
'not a captured data model. Write @DVModel(capture: true) on '
'${strangers.length == 1 ? 'it' : 'each'}, or take '
'${strangers.length == 1 ? 'it' : 'them'} out of models. '
'${captured.isEmpty ? 'No data model is captured.' : 'Captured: ${(captured.toList()..sort()).join(', ')}.'}',
);
}
}