I’m trying to use a contract for implying `Build.VERSION.SDK_INT < VERSION_CODES.TIRAMISU` Someth...
m
I’m trying to use a contract for implying
Build.VERSION.SDK_INT < VERSION_CODES.TIRAMISU
Something like:
Copy code
fun shouldShowCustomAcceptPushesDialog() : Boolean {
    contract {
        returns(true) implies (Build.VERSION.SDK_INT < VERSION_CODES.TIRAMISU)
        returns(false) implies (Build.VERSION.SDK_INT >= VERSION_CODES.TIRAMISU)
    }
    return Build.VERSION.SDK_INT < VERSION_CODES.TIRAMISU
}
Can someone help me what I’m doing wrong here:
unsupported construction
🤷
e
Kotlin contracts don't support that, and it wouldn't help you anyway: Android Lint is what checks SDK usage, and it doesn't understand contracts
1
If you invert the value you can use https://developer.android.com/reference/kotlin/androidx/annotation/ChecksSdkIntAtLeast which Android Lint does support
m
Thanks. Did not know this annotation exists. 👍