accept method
The field value for a valid upload stored at storageKey, pinned to
these exact bytes by their digest. Throws DVModel3DRejected otherwise.
Implementation
DVSceneAsset accept(List<int> bytes, {required String storageKey}) {
if (storageKey.isEmpty) {
throw ArgumentError.value(storageKey, 'storageKey', 'must not be empty');
}
final DVModel3DValidation validation = validate(bytes);
if (!validation.isValid) throw DVModel3DRejected(validation);
return DVSceneAsset(
kind: DVSceneAssetKind.model,
source: DVSceneAssetSource.stored,
reference: storageKey,
sha256: crypto.sha256.convert(bytes).toString(),
byteLength: bytes.length,
triangles: validation.summary!.triangles,
);
}