check method
The app of the matrix, the app with every module of modules that has
the providers, as the contract harness builds and renders it with
the roleOptions, with the data and roles of its case
(MatrixApp.hook), under name; or
null and the problems when not one app with every module has them:
the errors of the cases of the apps that the harness found errors in,
and the number of the apps that have them.
Implementation
Future<({MatrixApp? app, List<String> problems})> check() async {
final (:apps, :failed) = await everyModuleAppsOf(
modules,
roleOptions: roleOptions,
);
final withProviders = [
for (final app in apps)
if (providers.every(app.modules.contains)) app,
];
if (withProviders case [final app]) {
return (app: app._with(name: name), problems: const <String>[]);
}
final named = providers.isEmpty ? 'its modules' : providers.join(', ');
final count = '${withProviders.length} apps with every module of the '
'registry of $name have $named, rather than one.';
return (
app: null,
problems: [
for (final result in failed)
'${result.contractCase}: ${result.errors.join('; ')}',
count,
],
);
}