Quantcast
Channel: Dart: spread operator for constructor - Stack Overflow
Viewing all articles
Browse latest Browse all 6

Answer by Daniel P for Dart: spread operator for constructor

$
0
0

You can do something like this:

const BorderSide borderBase = BorderSide(  color: Colors.red,  width: 2,  style: BorderStyle.solid,);Container(  decoration: BoxDecoration(    border: Border.all(      color: borderBase.color,      width: borderBase.width,      style: borderBase.style,    ),  ),  child: Text('Container 1'),)Container(  decoration: BoxDecoration(    border: Border(      top: borderBase,    ),  ),  child: Text('Container 2'),)

Not the best but still some reuse.


Viewing all articles
Browse latest Browse all 6

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>