FunctionDeclaration.fromJson constructor

FunctionDeclaration.fromJson(
  1. Object? j
)

Implementation

factory FunctionDeclaration.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return FunctionDeclaration(
    name: switch (json['name']) {
      null => '',
      Object $1 => decodeString($1),
    },
    description: switch (json['description']) {
      null => '',
      Object $1 => decodeString($1),
    },
    parameters: switch (json['parameters']) {
      null => null,
      Object $1 => Schema.fromJson($1),
    },
    parametersJsonSchema: switch ((
      json.containsKey('parametersJsonSchema'),
      json['parametersJsonSchema'],
    )) {
      (false, _) => null,
      (true, Object? $1) => Value.fromJson($1),
    },
    response: switch (json['response']) {
      null => null,
      Object $1 => Schema.fromJson($1),
    },
    responseJsonSchema: switch ((
      json.containsKey('responseJsonSchema'),
      json['responseJsonSchema'],
    )) {
      (false, _) => null,
      (true, Object? $1) => Value.fromJson($1),
    },
    behavior: switch (json['behavior']) {
      null => FunctionDeclaration_Behavior.$default,
      Object $1 => FunctionDeclaration_Behavior.fromJson($1),
    },
  );
}