Say I have
class Cls {
int val;
int method();
}
var obj = Cls();
void f(int Function() arg) {...}
Of course, I can use
f(obj.method);
However, I cannot use
f(obj.val_as_a_getter_method)
but have to write the verbose
f(()=>obj.val)
I hope I can have something like in Java, where using lombok
we get those setter and getter methods, so we can call
f(obj.getVal)
Of course, similar things happens for setters. For brievity I do not repeat here.
Currently I write my own code generator that automatically generates setters and getters. Is there any better ways?
Thanks!