import 'dart:convert';
import 'package:http/http.dart' as http;
void main() async {
http.Response response = await createUser("Bob", "engineer");
print(response.body);
}
Future<http.Response> createUser(String name, String job) {
return http.post(
Uri.parse('https://reqres.in/api/users'),
headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8',
},
body: jsonEncode(<String, String>{
'name': name,
'job': job
}),
);
}