Stian N
06/29/2020, 10:57 AMobject? signature, and you can work around this with !!. Is this the prefered method?kqr
06/29/2020, 12:27 PM?.Stian N
06/29/2020, 1:01 PMfun doRequest(): User {
restTemplate.exchange<User>(...).body!!
}Filippo Pizzicola
06/29/2020, 1:13 PMreesp?.boby : User()mister11
06/29/2020, 2:10 PMUser? from doRequest method and let caller handle it or use something like ...body ?: DefaultUser().mister11
06/29/2020, 2:12 PMsealed class that has two variants: User or Failure. Similar to existing Result<T> class that Kotlin has, but it cannot be used (yet)Stian N
06/30/2020, 9:01 AMmister11
06/30/2020, 9:56 AMif (user == null) Either.left(error) else Either.right(user) or whatever the syntax is. Smart cast will know user in else it not null. That way, caller with get an error and handle it in some meaningful way.