import 'dart:async';
import 'dart:io';
main() {
var file = new File('/sys/class/leds/beaglebone:green:usr0/brightness');
var state = 0;
new Timer.periodic(new Duration(seconds: 2), (_) {
state = 1 - state;
file.writeAsStringSync('0$state', flush: true);
});
}
While it's not the most concise version, it's certainly very readable. Everyone can clearly see that the duration is 2 seconds and that that boolean flag is for flushing, because that's exactly what the code says.