I'm trying to create a cURL web request using the curl/curl.dart package. However, I get the error The argument type 'String' can't be assigned to the parameter type 'Uri'.. How do I convert String to Uri?
Here is my complete code:
final request = new Request("POST", "http://my.web.url/webservice/rest/server.php");
final wstoken = "my_token";
final moodlewsrestformat = "json";
final wsfunction = "core_user_create_users";
final username = "test_user_3";
final firstname = "John";
final lastname = "Doe";
final email = "[email protected]";
final password = "password_for_john";
request.bodyFields = {
"wstoken" : wstoken,
"moodlewsrestformat": moodlewsrestformat,
"wsfunction": wsfunction,
"users[0][username]" : username,
"users[0][firstname]" : firstname,
"users[0][lastname]" : lastname,
"users[0][email]" : email,
"users[0][password]" : password
};
print(toCurl(request));