prevent subclassing by making public constructor a factory
diff --git a/pkgs/io/lib/src/shared_stdin.dart b/pkgs/io/lib/src/shared_stdin.dart index 9b783d9..3bb0d27 100644 --- a/pkgs/io/lib/src/shared_stdin.dart +++ b/pkgs/io/lib/src/shared_stdin.dart
@@ -35,7 +35,10 @@ /// /// Calling this constructor more than once with the same source [stream] /// will likely result in an error. - SharedStdIn(Stream<List<int>> stream) { + factory SharedStdIn(Stream<List<int>> stream) => SharedStdIn._(stream); + + /// Actual constructor is private to prevent subclassing. + SharedStdIn._(Stream<List<int>> stream) { _sub = stream.listen(_onInput); }