Now that dart has both the spread operator and class extensions, you could abuse both to add ...spread
support to static
methods. While I doubt this is a good idea, I made a working dartpad (gist) to demonstrate. The end result looks something like:
final Border spreadBorder = Border.fromSides([ ...Border( left: BorderSide(color: Colors.pink), right: BorderSide(color: Colors.pinkAccent), ).sides, ...Border( top: BorderSide(color: Colors.blue), bottom: BorderSide(color: Colors.blueAccent), ).sides,]).scale(5);enum _Side { top, right, bottom, left }extension SpreadBorder on Border { Iterable<MapEntry<_Side, BorderSide>> get sides { return () sync* { if (top != BorderSide.none) { yield MapEntry(_Side.top, top); } // ...other yields }(); } static Border fromSides(Iterable<MapEntry<_Side, BorderSide>> parts) { BorderSide top, right, bottom, left; for (final borderPart in parts) { switch (borderPart.key) { case _Side.top: top = borderPart.value; break; // ... other cases } } return Border( top: top, right: right, bottom: bottom, left: left, ); }}