Diemex
Diemex

Reputation: 841

0xFF0000FF An integer literal does not conform to the expected type kotlin.Int

Why doesn't this work:

var color: Int = 0xFF0000FF

and why do I have to call toInt()

var color: Int = 0xFF0000FF.toInt()

Upvotes: 48

Views: 23684

Answers (2)

Faizan Haidar Khan
Faizan Haidar Khan

Reputation: 1215

I am using boolean an in my case I was using this way with same error

var shouldShowOnBoarding by remember { mutableStateOf(true) }

Previous import was

import androidx.compose.runtime.Composable

Then I changed it to

import androidx.compose.runtime.*

Upvotes: 0

Alexander Udalov
Alexander Udalov

Reputation: 32766

This is a bug in the compiler, feel free to vote / watch it: https://youtrack.jetbrains.com/issue/KT-2780

Upvotes: 47

Related Questions