String flip(String binary) { return binary.replaceAllMapped( RegExp('[01]'), (match) => match.group(0) == '1' ? '0' : '1'); }