getProductTag static method
Returns the ProductTag for this product and this tag key
Returns null if not found.
Implementation
static Future<ProductTag?> getProductTag({
required final String barcode,
required final String key,
final QueryType? queryType,
}) async {
final Map<String, String> parameters = <String, String>{};
/* TODO
if (owner != null) {
parameters['owner'] = owner;
}
*/
final Response response = await HttpHelper().doGetRequest(
UriHelper.getFolksonomyUri(
path: 'product/$barcode/$key',
queryParameters: parameters,
queryType: queryType,
),
queryType: queryType,
);
_checkResponse(response);
if (response.body == 'null') {
// not found
return null;
}
final Map<String, dynamic> json =
jsonDecode(response.body) as Map<String, dynamic>;
return ProductTag.fromJson(json);
}