That’s because we treat backend as dumb. It could send a null. So json[id] could be a string, or a double or a null. And if we directly parse it as int and it’s something else, it would throw an exception. So we parse it as a nullable int which means if it’s anything other than an int, it will become a zero. Sorry for delayed response, I am not well these days
@@_technotherapist Great, thanks for the detailed response and I pray for your speedy recovery. Looking forward to have more such informative videos. Thank you.
The project has only one repo and I am adding all the code to the same and updating it with every video. You can check the previous commits for old code if you want to see the start. I am not making separate repo for each video for this DevLogs series
Great series Waleed bhai! Thank you for your efforts! 👏
at 3:15, when we are setting default value in userJson,
id: json['id] as int? ?? 0
instead of this, why don't we write=> id: json['id] ?? 0
That’s because we treat backend as dumb. It could send a null. So json[id] could be a string, or a double or a null. And if we directly parse it as int and it’s something else, it would throw an exception. So we parse it as a nullable int which means if it’s anything other than an int, it will become a zero. Sorry for delayed response, I am not well these days
@@_technotherapist Great, thanks for the detailed response and I pray for your speedy recovery.
Looking forward to have more such informative videos.
Thank you.
Bhai is k Baki. Full project Kahan Hain??? From start...
The project has only one repo and I am adding all the code to the same and updating it with every video. You can check the previous commits for old code if you want to see the start. I am not making separate repo for each video for this DevLogs series
💞 "Promo sm"