【问题标题】:Flutter - How to set dynamic base url in Retrofit API request?Flutter - 如何在 Retrofit API 请求中设置动态基本 url?
【发布时间】:2022-01-22 20:05:49
【问题描述】:

这是我的 post API 的示例,我想更改此特定 API 端点的基本 URL。

@POST("/post")
@FormUrlEncoded()
Future<String> postUrlEncodedFormData(@Field() String hello);

【问题讨论】:

  • 请澄清您的具体问题或提供其他详细信息以准确突出您的需求。正如目前所写的那样,很难准确地说出你在问什么。

标签: flutter dart retrofit


【解决方案1】:

在获得一些资源后,我得到了这个解决方案及其对我的工作。

@POST("http://www.your_base_url.com/post")
@FormUrlEncoded()
Future<String> postUrlEncodedFormData(@Field() String hello);

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-07-29
    • 2020-06-19
    • 2018-05-19
    • 2019-12-01
    • 2016-04-03
    • 2016-09-24
    相关资源
    最近更新 更多