map<R> method

R map<R>({
  1. required ResponseMap<NodesPostResponse201, R> on201,
  2. ResponseMap<NodesPostResponse, R>? onElse,
})

Implementation

R map<R>({
  required ResponseMap<NodesPostResponse201, R> on201,
  ResponseMap<NodesPostResponse, R>? onElse,
}) {
  if (this is NodesPostResponse201) {
    return on201((this as NodesPostResponse201));
  } else if (onElse != null) {
    return onElse(this);
  } else {
    throw StateError('Invalid instance of type $this');
  }
}