blob: 2b715c2c46c53f86d085f31f42153f0af8bf0599 [file] [log] [blame]
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
/// A [StringSink] that writes into two other [StringSink]s.
class TeeStringSink implements StringSink {
final StringSink sink1;
final StringSink sink2;
TeeStringSink(this.sink1, this.sink2);
@override
void write(Object? obj) {
sink1.write(obj);
sink2.write(obj);
}
@override
void writeAll(Iterable<dynamic> objects, [String separator = '']) {
sink1.writeAll(objects, separator);
sink2.writeAll(objects, separator);
}
@override
void writeCharCode(int charCode) {
sink1.writeCharCode(charCode);
sink2.writeCharCode(charCode);
}
@override
void writeln([Object? obj = '']) {
sink1.writeln(obj);
sink2.writeln(obj);
}
}