get_attributes method
dynamic
get_attributes(
{ - String? context,
})
Implementation
get_attributes({String? context}) async {
String request_api = 'products/attributes';
var res = await ApiServices()
.getRequest(request_api, baseUrl, consumerKey, consumerSecret);
// print(res);
var decode_data = json.decode(res.body);
print(decode_data);
if (decode_data != null) {
return ProductAttriduteModel.fromJson(decode_data);
} else {
List<ProductAttriduteModel> attridutes_list = [];
for (var i = 0; i < decode_data.length; i++) {
// print('kjidfk$i');
ProductAttriduteModel attridutes_data =
ProductAttriduteModel.fromJson(decode_data[i]);
attridutes_list.add(attridutes_data);
}
return attridutes_list;
}
}