I would like to be able to do something like apply() from Kotlin in Dart. For example in Kotlin
var userDetails: UserDetails = userRepo.getUser().apply{
//here 'this' is UserDetails so all the further calls are made in that context
name = "Name"
email = "email@test.com"
callSomeInnerMethodOfUserDetails()
};
Is there some similar method or way to do it in Dart language?
I want to know whether there are some things in standard library or language itself, rather than my own generic closure extension for such a purpose?
Thanks.