如何通过BLOC创建一个简单的帖子请求?
我需要通过Bloc创建一个简单的帖子请求。单击按钮时发送它。我该怎么做? 我需要一个简单的请求而无需解析。只是发送。 我的按钮:
OutlinedButton(
onPressed: _sendReq,
child: Text("Send request"),
),
Future<void> _sendReq() async {
}
我的API:
https://api.dev.certihire.com/api/v1/admin-sessions
I need to create a simple POST request via bloc. To send it when the button is clicked. How can i do this?
I need a simple request without parsing. Just send.
My button:
OutlinedButton(
onPressed: _sendReq,
child: Text("Send request"),
),
Future<void> _sendReq() async {
}
My API:
https://api.dev.certihire.com/api/v1/admin-sessions
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
请查看下面的文章,通过Retrofit+Dio致电API,以获取BLOC状态管理技术
https://medium.flutterdevs.com/flutter-bloct-bloc-for-state-management-using-dio-with-with-with-with-retrofit-ca87746363634d
Please check below article to call the API via retrofit+Dio for BLoC state management techniques
https://medium.flutterdevs.com/flutter-bloc-for-state-management-using-dio-with-retrofit-ca877463634d
您可以简单地使用Bloc和Firebase创建发布请求。创建Firebase收集并将数据发布到它。为此,您需要调用FirebaseFirestore实例的add()方法。如
FirebaseFirestore.instance.Collection(“产品”);
这里的产品是收藏名称。
从UI导致事件调用add()方法。此方法应在您的存储库中。
这里更多
https://youtu.be/peqnfcispak
You can simple use bloc and firebase to create post request. Create firebase collection and post data to it. To do it you need call add() method of FirebaseFirestore instance. like below
FirebaseFirestore.instance.collection("products");
Here products is the collection name.
From UI cause events to call add() method. This method should be inside your repository.
Here more
https://youtu.be/PEQnFCIspAk