validateCodeAssetInApplication function

Future<ValidationErrors> validateCodeAssetInApplication(
  1. List<EncodedAsset> assets
)

Validates that the given code assets can be used together in an application.

Some restrictions - e.g. unique shared library names - have to be validated on the entire application build and not on individual hook/build.dart invocations.

Implementation

Future<ValidationErrors> validateCodeAssetInApplication(
    List<EncodedAsset> assets) async {
  final fileNameToEncodedAssetId = <String, Set<String>>{};
  for (final asset in assets) {
    if (asset.type != CodeAsset.type) continue;
    _groupCodeAssetsByFilename(
        CodeAsset.fromEncoded(asset), fileNameToEncodedAssetId);
  }
  final errors = <String>[];
  _validateNoDuplicateDylibNames(errors, fileNameToEncodedAssetId);
  return errors;
}