Issues Fix on Products Fetching, Orders Fetching & Products reviews. #63
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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'stotal_salesproperty type toString.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 toString, and if it'sList, then it will join all the elements separated by comma,. This function takes the value and then returns aStringvalue that is then assigned to itskeyin 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 themeta_dataof coupon is different than the othersmeta_dataand the oneMetaDatamodel, 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.