getBundleByKref method
- String krefUri
Gets a bundle by kref, returned as a Bundle model.
Verifies the item's kind is bundle, mirroring Python's
get_bundle_by_kref; throws a KumihoError if the item exists but is
not a bundle.
final bundle = await client.getBundleByKref(
'kref://film-2024/assets/character.bundle');
final members = await bundle.getMembers();
Implementation
Future<models.Bundle> getBundleByKref(String krefUri) async {
final response = await getItemByKref(krefUri);
if (response.kind != 'bundle') {
throw KumihoError(
"Item '$krefUri' is not a bundle (kind='${response.kind}'). "
'Use item() for non-bundle items.',
);
}
return models.Bundle(response, this);
}