In Dart/Flutter, I have a StreamController defined like this:
MyEventStreamer() {
_controller = StreamController<TimedEvent>(
onListen: _startStream,
onResume: () {
throw UnimplementedError();
},
onPause: () {
throw UnimplementedError();
},
onCancel: _stopStream);
_calculateEventTimes();
}
The reason I have the throws is that I don't want onPause or onResume to be used... and I want to throw an error in case I forget this later.
However, since these are apparently not called explicitly (and the docs don't seem to describe when they are called), I'm concerned that these may be called by the system under certain unknown circumstances... such as lifecycle events on mobile when the app is backgrounded, etc... which would be bad.
Is this a legitimate concern -- or are these methods never called by anything other than code the programmer wrote?