@Dao interface ExampleDao { @Query("SELECT * FROM example_table WEHRE id = :id") fun getExample(id: Int): LiveData<Example> }
如果数据库中没有匹配的ID,上述查询返回什么?我猜它不能为null,因为返回类型不可为null。
如果返回类型可为空,查询是否返回null?像LiveData<Example>?或LiveData<Example?>
LiveData<Example>?
LiveData<Example?>