when<R>  method 
      
R
when<R>({  
    
- required R data(- T value
 
- required R done(),
- required R error(),
Invokes the appropriate function on the StreamNotification based on the kind.
Implementation
@pragma('vm:prefer-inline')
@pragma('dart2js:prefer-inline')
R when<R>({
  required R Function(T value) data,
  required R Function() done,
  required R Function(ErrorAndStackTrace) error,
}) {
  final self = this;
  if (self is DataNotification<T>) {
    return data(self.value);
  }
  if (self is DoneNotification) {
    return done();
  }
  if (self is ErrorNotification) {
    return error(self.errorAndStackTrace);
  }
  throw StateError('Unknown notification $self');
}