Skip to content

Instantly share code, notes, and snippets.

View anders-sandholm's full-sized avatar

Anders Thorhauge Sandholm anders-sandholm

View GitHub Profile
@anders-sandholm
anders-sandholm / widget.dart
Last active February 28, 2018 04:15
Clean Dart 2 Widgets
// Before Dart 2
Widget build(BuildContext context) {
return new Container(
height: 56.0,
padding: const EdgeInsets.symmetric(horizontal: 8.0),
decoration: new BoxDecoration(color: Colors.blue[500]),
child: new Row(
...
),
);
void main() {
List<int> prices = ['99', '27', '10000', '20000000'];
// Sort in place from smallest to largest
prices.sort();
print('Lowest price is ${prices[0]}!');
}