fetch<T, K> method
It fetch single asset data on the basis of the asset uid.
var stack = contentstack.Stack(apiKey, deliveryToken, environment);
asset.fetch<AssetModel, void>().then((response) {
print(response);
}).catchError((error) {
print(error['error_code']);
});
Implementation
Future<T> fetch<T, K>() {
if (_uid == null || _uid.isEmpty) {
throw Exception('Provide asset uid to fetch single entry');
}
final uri =
Uri.https(_client.stack.endpoint, '$_urlPath/$_uid', assetParameter);
return _client.sendRequest<T, K>(uri);
}