0

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
userName
  • 903
  • 2
  • 20

2 Answers2

0

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

ABV
  • 857
  • 2
  • 3
0

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

dylan
  • 319
  • 2
  • 4