问题标签 [chopper]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
4067 浏览

php - Flutter + Chopper POST API 在网络中不起作用

我对颤振完全陌生。在学习颤振时,我无法使用颤振 Web 应用程序登录,相同的代码在 android 移动应用程序中运行良好。

请查找以下日志信息。相同的调用在所有平台上都有效,除了 Flutter Web

信息:2020-05-22 17:40:48.229: curl -v -X POST -H 'content-type: application/json; charset=UTF-8' -H 'Accept: / ' -H 'Cache-Control: no-cache' -H '连接: keep-alive' -d '{"username":"admin","password":" admin@123"}' http://healthvedic.in/api/admin/user/login.php

“String”类型的预期值,但得到“ClientException”类型之一


呼叫地点

}

以下是 PHP Rest-API 中的标头

0 投票
0 回答
414 浏览

flutter - 为什么在尝试使用颤振斩波器库调用发布 Web 服务时出现错误?

我正在尝试通过颤振斩波器库将一些参数传递给 Web 服务,否则该库工作正常,但颤振斩波器返回错误。这是代码。

这是生成的类代码。

这就是我尝试调用此方法的方式,但我总是遇到错误。

这是错误:

0 投票
4 回答
1797 浏览

flutter - 不良状态:意外诊断:颤振升级到 1.20.1 后

问题是什么?

0 投票
0 回答
275 浏览

flutter - Flutter Chopper 库缓存 http 响应

在我的移动应用程序中,我正在使用Chopper http库,我想用这个库缓存 http 响应,我的服务器返回这个带有响应的标头:

我将此拦截器添加到chopper拦截器中:

现在我希望缓存对我的应用程序正常工作,这个解决方案是否正确?

0 投票
1 回答
598 浏览

rest - 如何将 json_serializable 与 Chopper 一起使用?

我试图弄清楚如何将 Chopper 与 json_serializable 一起使用,但没有太多关于它的文档。我正在查看Chopper GitHub 中的示例,但我不知道我打算将什么用作 JsonSerializableConverter 的参数(第 17-20 行不是有效的 Map,这是该类想要的)。

我的所有课程都有一个单独的文件。每个类都有一个 toJson 和 fromJson 函数。

到目前为止,这是我的 Chopper 服务(当然,此代码不起作用,可能还有其他问题):

0 投票
1 回答
655 浏览

flutter - Flutter Chopper 不处理错误响应

我在这样的颤振项目中使用斩波器。

AuthRestService 类:

我使用注册电话的方式..

这是webcall的日志(成功和失败)..

我在日志中得到的错误是:

我在我的项目中使用了相同类型的 RestService,它指向另一台服务器并且它可以工作,这个 AuthRestService 是用于 firebase 身份验证的 restservice 的精确副本。我在日志中遇到的错误来自我们调用“注册”API 的那一行,这让我对我的 ChopperClient 感到好奇。

大家知道怎么回事吗??请帮忙。谢谢。

0 投票
0 回答
216 浏览

flutter - 在 Flutter/Dart 上创建 Chopper 客户端的最佳方式是什么?

我在 Flutter 上使用 Chopper 进行 http 请求,据我所知,有两种方法可以创建 Chopper 客户端。一种是将服务添加到其数组中,然后将其公开:

另一个是为每个服务创建一个 Chopper 客户端的新实例:

我的问题是:哪种方式可以获得最佳性能?在我看来,数组方法可能会使用更多内存。提前致谢!

0 投票
1 回答
428 浏览

flutter - Using Chopper networking library with flutter_bloc library in flutter

I am using the Chopper library to invoke Rest APIs and flutter_bloc for my business logic.

My Chopper class

My model class... Future<Response> is like

Events class code:

State class code:

and this is my Bloc(mapEventToState) code

I'm trying to call Bloc's code from my UI like below:

I am able to call the API successfully and able to get the response. But not able to display in the UI. Receiving below exception:

Please guide me on how to solve the above issue.

0 投票
1 回答
448 浏览

json - 在颤动中使用 Chopper 库将 JSON 响应转换为模型对象?

我正在使用 Chopper 库来调用 rest API 调用。

我已经按照Raywenderlich Chopper 教程教程在我的项目中实现 API 调用。

在本教程中,他们使用以下代码将 JSON 响应转换为流行模型对象。

这可以。但在我的项目中,我必须进行多个 API 调用,并且需要解码多个 JSON 响应以响应 Dart 模型对象。

那么如何解码多个 API 调用响应呢?我是否需要执行以下操作:

如何进一步进行?

0 投票
0 回答
61 浏览

spring - How to send complex model with files in flutter via chopper to spring

Assume we are creating a social network site. I try to send a model that contains multiple comments each comment could contain multiple files.

MainModel

Comment class should look like:

The question is: How to send this MainModel via flutter (chopper lib) and receive it in spring boot.

I saw threads where people just send a simple file with flutter to spring boot, but never seen threads where people send complex model with multiple files