The library accept `Boolean` but I am using `Boole...
# android
a
The library accept
Boolean
but I am using
Boolean?
m
the library doesn’t know how to handle
null
, since it expects
true
and
false
only
đź‘Ť 2
r
remove the question mark lol
a
@rkeazor lol. will it cause any error or inconsistency?
@m1shk4 thanks. just wondering if there is other alternative solution other than remove the question mark.
r
why would there be a inconsistency. the error says its expecting a boolean, but your giving it a nullable boolean
could you paste a small code sample perhaps
small lol
a
Copy code
override fun read(`in`: JsonReader?): Response {
        `in`?.beginObject()
        while (`in`?.hasNext()) { << Here is the error
            val token: JsonToken = `in`.peek()
        }
    }
@rkeazor what is the syntax meaning of ``` for the
in
?
r
You need a better naming convention
its because in is a kotlin key word
a
@rkeazor That one is automatic generate by the generator when I hit ALT + Insert to generate the override method.
r
so it uses the double ticks to specify that your using it to name a vairable
doesn’t matter. just change the name from in, to something more understandble
for instance
a
So it does not represent anything but to tell the compiler this is a variable name?
r
jsonReader: JsonReader
a
Ah! After I change it to reader.
Thanks.
Then it work well.
r
no prob
a
Now I know why it is
in
already.
Maybe it could be a keyword.
r
yes its a keyword
a
So the indicate as
in
to tell the compiler actually this is a variable, not a keyword.
r
yes
its like naming a variable , when
a
Great! Thanks @rkeazor!
r
no prob