This issue assumes that Dart will have a convenient dot syntax in the somewhat near future:
Padding(
padding: .only(left: 42.0),
)
Problem
Both EdgeInsets and EdgeInsetsDirectional have a .only() constructor; there would need to be a way to differentiate between the two.
Proposal
Change the class structure.
Before
abstract class EdgeInsetsGeometry {}
class EdgeInsets extends EdgeInsetsGeometry {}
class EdgeInsetsDirectional extends EdgeInsetsGeometry {}
After
@Deprecated()
typedef EdgeInsetsGeometry = EdgeInsets;
class EdgeInsets {}
class EdgeInsetsDirectional extends EdgeInsets {}
And then .only() would hopefully be interpreted as EdgeInsets.only() by default.
(The same would be done with AlignmentGeometry and BorderRadiusGeometry as well.)
I believe this should be a mostly trivial/non-breaking transition, with one catch:
void foo(EdgeInsetsDirectional directionalPadding) {
print(directionalPadding is EdgeInsets); // would change from "false" to "true"
}
Assumption
This issue assumes that Dart will have a convenient dot syntax in the somewhat near future:
Problem
Both
EdgeInsets
andEdgeInsetsDirectional
have a.only()
constructor; there would need to be a way to differentiate between the two.Proposal
Change the class structure.
Before
After
And then
.only()
would hopefully be interpreted asEdgeInsets.only()
by default. (The same would be done with AlignmentGeometry and BorderRadiusGeometry as well.)I believe this should be a mostly trivial/non-breaking transition, with one catch: