Open qholi opened 5 years ago
another solution could be
class C {
A a;
get isLoading = a.b.isLoading;
set isLoading = a.b.isLoading;
}
Forwarding operations to another object is something that can be useful in multiple situations, especially when you can avoid repeating parameters.
We currently only support that for constructors: Superclass(int x) = Subclass;
The =
syntax for a function declaration could be reused, so you can write:
returnType someFunction(ArgumentType x) = _otherObject._otherFunction;
We currently only support that for constructors:
Superclass(int x) = Subclass;
Couldn't it be simplify to Superclass = Subclass;
in the case of parameters match?
We could potentially allow omitting the parameters from the redirecting constructor (which must be a factory constructor). It may make parsing harder, but it's should not be completely impossible for constructors (I can't guarantee it'll extend to other declarations too because then it might look like a variable declaration).
I always use this workaround as an alias for a variable.
Could add a new keyword like below to make it easily?
Dart Version: 2.2.0 OS: Windows Browser: Chrome