❔ What's the reason for the warning?
I don't understand why this warning create, because I created check with if
10 Replies
you can add ! after [0] to silence the warning
well i think
is not null
instead of !=
would silence the warningOr
okey. thanks
why do you have
Product?[]
instead of Product[]
? does that method return a collection that might have null elements?
that's why the warning is there in the first place, you're telling the compiler that you expect some elements might be nullWell, the ?. operator indicates that the type can accept null. Because of this, the compiler will generate warnings everywhere to prompt null checks. I actually implemented the null check, but the warning didn't go away.
right, so the root question is does
GetProducts
give you a collection that can have null elements?
why would it do that?Unknown User•16mo ago
Message Not Public
Sign In & Join Server To View
I know, my question, okey I will show you two code, what is difference? why does one of them have a "warning" and the other one doesn't?
1) first one:
2) another one:
Second has warning
Unknown User•16mo ago
Message Not Public
Sign In & Join Server To View
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.