In my flutter app, I have widgets like below:
Container( decoration: BoxDecoration( border: Border.all( color: Colors.red, width: 2, style: BorderStyle.solid, ), ), child: Text('Container 1'),)
Container( decoration: BoxDecoration( border: Border( top: BorderSide( color: Colors.red, width: 2, style: BorderStyle.solid, ), ), ), child: Text('Container 2'),)
Both use the same properties for their borders. So I was wondering if there's a spread-operator-like way of inserting the same properties for both widgets? Maybe like:
const borderBase = ( color: Colors.red, width: 2, style: BorderStyle.solid,)Container( decoration: BoxDecoration( border: Border.all( ...borderBase, ), ), child: Text('Container 1'),)Container( decoration: BoxDecoration( border: Border( top: BorderSide( ...borderBase, ), ), ), child: Text('Container 2'),)