skip to Main Content

my name is Marques and desenvolving a flutter project for my end project in school and i’m a little but desesperated with a error that i can’t solve .
I hope someone could help solving this to could continue making my flutter app.

The error image
they are saying that ‘The argument type String can’t be assigned to the Parameter Uri’

Adding as Uri and making a run of the mobile flutter project when i enter the email and password and click into the Login Button appers the next message to me
error message
I hope someone could help me I will be very grateful

I had tried to change it or to add a similar code but didnt work

3

Answers


  1. Try This Way

    await http.post(Uri.parse("http://localhost/tienda/login.php"));
    
    Login or Signup to reply.
  2. The post() method of http package expects Uri instead of string.

    All you need to do is parse the url string you provided.

    final response = await http.post(
      Uri.parse("http://localhost/tienda/login.php"),
      body: {
        "username": // username,
        "password": // password
      }
    );
    
    Login or Signup to reply.
  3. Uri.parse("http://localhost/tienda/login.php")
    

    Instead of using as Uri, try to parse the string with the following way.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search