Created
September 8, 2022 05:46
-
-
Save LMBernardo/78f77b37b800b01a57ea2362d08e9cd2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:http/http.dart' as http; | |
Future<bool> sendPost() async { | |
Map<String,String> headers = { | |
"Accept": "application/json", | |
"content-type": "application/json", | |
}; | |
var response = await http.post( | |
Uri.parse('https://httpbin.org/post'), | |
headers: headers, | |
body: "{\"email\":\"[email protected]\",\"username\":\"\",\"mobile_phone_number\":\"\",\"password\":\"david\"}"); | |
print(response.statusCode); | |
print(response.body.toString()); | |
if(response.statusCode == 200){ | |
return true; | |
} | |
return false; | |
} | |
void main(){ | |
sendPost(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment