FunctionResponse.fromJson constructor

FunctionResponse.fromJson(
  1. Object? j
)

Implementation

factory FunctionResponse.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return FunctionResponse(
    id: switch (json['id']) {
      null => '',
      Object $1 => decodeString($1),
    },
    name: switch (json['name']) {
      null => '',
      Object $1 => decodeString($1),
    },
    response: switch (json['response']) {
      null => null,
      Object $1 => Struct.fromJson($1),
    },
    parts: switch (json['parts']) {
      null => [],
      List<Object?> $1 => [
        for (final i in $1) FunctionResponsePart.fromJson(i),
      ],
      _ => throw const FormatException('"parts" is not a list'),
    },
    willContinue: switch (json['willContinue']) {
      null => false,
      Object $1 => decodeBool($1),
    },
    scheduling: switch (json['scheduling']) {
      null => null,
      Object $1 => FunctionResponse_Scheduling.fromJson($1),
    },
  );
}