Skip to content

fix: "Type 'Null' is not a subtype of type 'List<dynamic>'" exception - #112

Open
sebipirpi wants to merge 15 commits into
Morel-Tech:mainfrom
sebipirpi:main
Open

fix: "Type 'Null' is not a subtype of type 'List<dynamic>'" exception#112
sebipirpi wants to merge 15 commits into
Morel-Tech:mainfrom
sebipirpi:main

Conversation

@sebipirpi

@sebipirpi sebipirpi commented Mar 11, 2025

Copy link
Copy Markdown

Problem
When retrieving the images for catalog products, an exception is thrown because the "related_objects" field is not expected to be nullable. However, in my case, it is missing from the response entirely. This is reproducible via the Rest API as well, when sending a GET request http://connect.squareupsandbox.com/v2/catalog/object/{id} for an image for example.

Fix
Make the "related_objects" field nullable in the responses for "retrieve_catalog_objects" and "batch_retrieve_catalog_objects".

… in retrieve_catalog_objects and batch_retrieve_catalog_objects response
@sebipirpi
sebipirpi requested a review from mtwichel as a code owner March 11, 2025 21:17
@sebipirpi

Copy link
Copy Markdown
Author

@mtwichel can you please review this when you have time?

@sebipirpi

Copy link
Copy Markdown
Author

@fabriziocacicia @BruceClark406 could you please take a look at this?

@mtwichel mtwichel left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks for the contribution!

@mtwichel mtwichel changed the title Fix "Type 'Null' is not a subtype of type 'List<dynamic>'" exception fix: "Type 'Null' is not a subtype of type 'List<dynamic>'" exception Mar 18, 2025
@sebipirpi

sebipirpi commented Mar 19, 2025

Copy link
Copy Markdown
Author

@mtwichel one of the checks fails because of a method that I didn't touch as far as I can tell, more specifically "_$BatchRetrieveCatalogObjectsRequestFromJson". The line length exceeds 80 characters where it's declared. Should I rename it?

@mtwichel

Copy link
Copy Markdown
Collaborator

@mtwichel one of the checks fails because of a method that I didn't touch as far as I can tell, more specifically "_$BatchRetrieveCatalogObjectsRequestFromJson". The line length exceeds 80 characters where it's declared. Should I rename it?

Looks like it just failed the formatter. Could you try running dart format . in the root of the repository? That should fix it up.

@sebipirpi

Copy link
Copy Markdown
Author

@mtwichel one of the checks fails because of a method that I didn't touch as far as I can tell, more specifically "_$BatchRetrieveCatalogObjectsRequestFromJson". The line length exceeds 80 characters where it's declared. Should I rename it?

Looks like it just failed the formatter. Could you try running dart format . in the root of the repository? That should fix it up.

Done, thanks.

@sebipirpi
sebipirpi requested a review from mtwichel March 24, 2025 12:19
@sebipirpi

Copy link
Copy Markdown
Author

@mtwichel is there anything else I can do on my part? From what I can see, this check has failed for other PRs as well.

@sebipirpi

Copy link
Copy Markdown
Author

@mtwichel could you please take a look when you have time?

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.

2 participants