Skip to content

Conversation

@MubeenMurj
Copy link

Issue Fixed 1:
Error: type 'String is not a subtype of type int.' When trying to fetch products. This is a rare Woocommerce API issue that sometimes sets the first product's total_sales property type to String.

Issue Fixed 2:
The Endpoints function has different types of parameters and if the parameter's type was List<int> it was also being directly converted into a string and then the result we were getting was this string '[v1,v2,v3...]'. When query value is sent like this, the Woocommerce API wasn't giving expected results. In return, it was returning only one result in the list.
So I created a function _paramToString() that will check that is the parameter type. If it's any other type, then it will convert it to String, and if it's List, then it will join all the elements separated by comma ,. This function takes the value and then returns a String value that is then assigned to its key in the payload.

Issues Fixed 3:
Fix MetaData.fromJson in order.dart for non String value. When trying to fetch orders and if any of the orders have a coupon applied. This was happening because the meta_data of coupon is different than the others meta_data and the one MetaData model, that is already defined in the app.
So I created another class for the coupon metadata field and its value field.

Completed Function
The getProductReviews() function was not working and some parameters were missing. Fixed its issues and now it's working well.

MubeenMurj added 11 commits June 2, 2021 12:38
For any endpoint function, whenever there's a parameter of type List<int>, it was directly converted into string and the results were => '[v1,v2,v3....]'.
When the request was sent, the Api returns only one result.
So now, a function is added that joins the list elements like v1,v2,v3... and this works perfectly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant