How to send https post request in "flutter / dart" with an if statement How to send https post request in "flutter / dart" with an if statement dart dart

How to send https post request in "flutter / dart" with an if statement


Dart is exceptionally good for quickly and efficiently implementing such operations, all thanks to its powerful http library.

All you have to do is import the http library in your dart file and perform a post operation from an async function.

import 'dart:http' as http;[...]void sendInfo({String amount,String description,String reference,String callbackurl}) async{ http.post( callbackurl, body: json.encode(   {     "amount" : amount,     "description": description,     "reference": reference   } )      ).then((response){print("Response Code : ", response.statusCode);print("Response Body : ", response.body);// Perform the required operation(s) });}