Method.fromJson constructor

Method.fromJson(
  1. Object? j
)

Implementation

factory Method.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return Method(
    name: switch (json['name']) {
      null => '',
      Object $1 => decodeString($1),
    },
    requestTypeUrl: switch (json['requestTypeUrl']) {
      null => '',
      Object $1 => decodeString($1),
    },
    requestStreaming: switch (json['requestStreaming']) {
      null => false,
      Object $1 => decodeBool($1),
    },
    responseTypeUrl: switch (json['responseTypeUrl']) {
      null => '',
      Object $1 => decodeString($1),
    },
    responseStreaming: switch (json['responseStreaming']) {
      null => false,
      Object $1 => decodeBool($1),
    },
    options: switch (json['options']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) Option.fromJson(i)],
      _ => throw const FormatException('"options" is not a list'),
    },
    syntax: switch (json['syntax']) {
      null => Syntax.$default,
      Object $1 => Syntax.fromJson($1),
    },
  );
}