Open
Description
See https://api.dartlang.org/stable/1.22.1/dart-convert/ClosableStringSink/close.html
void close()
Closes this and flushes any outstanding data.
In fact this method does flush but doesn't close the sink
import "dart:convert";
main() {
StringBuffer stringSink = new StringBuffer();
stringSink.write("0:");
ClosableStringSink sink =
new ClosableStringSink.fromStringSink(stringSink, () {
stringSink.write(":closed");
});
sink.write("1");
print(stringSink.toString()); // prints 0:1
sink.close();
print(stringSink.toString()); // prints 0:1:closed
sink.write(":2");
sink.close();
print(stringSink.toString()); // prints 0:1:closed:2:closed
}
As you can see close() can be called several times. If the current behaviour is correct, and close() should only call onClose, then flush() is more suitable name for this method than close().