FunctionCallingConfig.fromJson constructor

FunctionCallingConfig.fromJson(
  1. Object? j
)

Implementation

factory FunctionCallingConfig.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return FunctionCallingConfig(
    mode: switch (json['mode']) {
      null => FunctionCallingConfig_Mode.$default,
      Object $1 => FunctionCallingConfig_Mode.fromJson($1),
    },
    allowedFunctionNames: switch (json['allowedFunctionNames']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeString(i)],
      _ => throw const FormatException(
        '"allowedFunctionNames" is not a list',
      ),
    },
  );
}