You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Got the following exception message while accessing variants property of a Submission object from my SubmissionPost class:
The following _TypeError was thrown building SubmissionPost(dirty):
type 'Null' is not a subtype of type 'String'
When the exception was thrown, this was the stack
#0 new SubmissionPreview._fromMap
package:draw/…/models/submission_impl.dart:491
#1 Submission.variants
package:draw/…/models/submission_impl.dart:254
Additionally, I have also found that this happens only when the variants field from the JSON object is not empty
The text was updated successfully, but these errors were encountered:
#216fixes this. I no longer use DRAW so do any follow-up if required using a PR.
Firstly, DRAW is based on PRAW and from my knowledge PRAW no longer contains the thumbnail or variants fields. The reason is that these are provided dynamically and thus the only way to access them in PRAW now is by the using the raw object. As such i have no idea why this is even present in DRAW.
Secondly:
Additionally, I have also found that this happens only when the variants field from the JSON object is not empty
This is because the line causing the error is only called when a variant is present.
Thirdly, the cause of the error:
From a quick look the code is trying to do this:
late String _id;
// later on
_id = map['id']; // this is a map containing all the variant data
Now the problem is that there is noid field in the JSON object. The only fields present are source and resolutions.
Temporary Fix:
use the data field to manually get the object and parse it yourself
OR
until the PR that i provided gets merged, clone my branch preview-fix branch and use it instead.
If thumbnail and variants aren't present anymore in Reddit's response, we should just remove them. Either way, thanks for submitting a PR, I'll take a look.
Got the following exception message while accessing variants property of a Submission object from my SubmissionPost class:
Additionally, I have also found that this happens only when the variants field from the JSON object is not empty
The text was updated successfully, but these errors were encountered: