You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
privateval_connectedPeripheral:MutableLiveData<MyDevice> =MutableLiveData()
publicval connectedPeripheral:LiveData<MyDevice>
get() =_connectedPeripheralprivateval bleManager =MyBleManager(context)
publicfundisconnect() {
if (bleManager.currentConnectedDevice ==null)
return
bleManager.disconnect()
_connectedPeripheral.value =null//this should not be allowed, as the LiveData wasn't declared nullable
startScanning()
}
It compiles and runs, though it would add the possibility of a NPE where it isn't expected.
With the current androidx.lifecycle:lifecycle-livedata-core-ktx:2.6.1 package it rightfully gets marked by Android Studio as error and thus does not compile.
The text was updated successfully, but these errors were encountered:
I rather thought it's due to an implementation error, but digging further into it it seems the issue is a java <-> kotlin one.
I can reproduce said problem when exchanging the ble-livedata with androidx.lifecycle:lifecycle-livedata:2.6.1
Internally, the package androidx.lifecycle:lifecycle-livedata-core-ktx seems to ensure and enforce the null safety.
This issue would probably fit with #483 for a kotlin specific package :)
I have the following piece of code:
It compiles and runs, though it would add the possibility of a NPE where it isn't expected.
With the current androidx.lifecycle:lifecycle-livedata-core-ktx:2.6.1 package it rightfully gets marked by Android Studio as error and thus does not compile.
The text was updated successfully, but these errors were encountered: