Created
January 5, 2019 03:23
-
-
Save ctalladen78/e3bf12bd8d38864388e53294bc6b1741 to your computer and use it in GitHub Desktop.
dart / flutter http post request using typiform api
This file contains hidden or 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 'dart:convert'; | |
| import 'dart:async'; | |
| import 'package:http/http.dart' as http; | |
| // https://pub.dartlang.org/packages/http | |
| Future<null> postData () async { | |
| var client = new http.Client(); | |
| // signature : post( dynamic uri, body: dynamic ) returns Future<Response> | |
| final response = await http.post('https://jsonplaceholder.typicode.com/posts/1', | |
| body: {"test" : "new post"} | |
| ); | |
| if(response.statusCode == 200){ | |
| print(response.body); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment