title: Http requests not getting response when using flutter
body: <p>I've been fairly new to flutter. I was tasked to send the email, name, and password for a signup link given to me. The response on 
  <a href="https://i.stack.imgur.com/XFyLf.png" rel="nofollow noreferrer">postman response when sending request</a></p>
  
  <p>The reference PHP code for signup  <a href="https://www.androidhive.info/2014/01/how-to-create-rest-api-for-android-app-using-php-slim-and-mysql-day-23/" rel="nofollow noreferrer">link</a></p>
  
  <pre><code>        index.php
      /**
       * User Registration
       * url - /register
       * method - POST
       * params - name, email, password
       */
  
  $app-&gt;post('/register', function() use ($app) {
              // check for required params
              verifyRequiredParams(array('name', 'email', 'password'));
  
          $response = array();
  
          // reading post params
          $name = $app-&gt;request-&gt;post('name');
          $email = $app-&gt;request-&gt;post('email');
          $password = $app-&gt;request-&gt;post('password');
  
          // validating email address
          validateEmail($email);
  
          $db = new DbHandler();
          $res = $db-&gt;createUser($name, $email, $password);
  
          if ($res == USER_CREATED_SUCCESSFULLY) {
              $response["error"] = false;
              $response["message"] = "You are successfully registered";
              echoRespnse(201, $response);
          } else if ($res == USER_CREATE_FAILED) {
              $response["error"] = true;
              $response["message"] = "Oops! An error occurred while registereing";
              echoRespnse(200, $response);
          } else if ($res == USER_ALREADY_EXISTED) {
              $response["error"] = true;
              $response["message"] = "Sorry, this email already existed";
              echoRespnse(200, $response);
          }
      });
  </code></pre>
  
  <p>The flutter code for sending data is</p>
  
  <pre><code>import 'package:flutter/material.dart';
  import 'dart:convert';
  import 'package:http/http.dart' as http;
  
  import 'newScreen.dart';
  
  void main() =&gt; runApp(MyApp());
  
  class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
  return MaterialApp(
    home: Scaffold(
        appBar: AppBar(title: Text('User Registration Form')),
        body: Center(
          child: RegisterUser()
          )
        )
      );
  }
  }
  
  class RegisterUser extends StatefulWidget {
  
  RegisterUserState createState() =&gt; RegisterUserState();
  
  }
  
  class RegisterUserState extends State {
  
    // Boolean variable for CircularProgressIndicator.
    bool visible = false ;
  
    // Getting value from TextField widget.
    final nameController = TextEditingController();
    final emailController = TextEditingController();
    final passwordController = TextEditingController();
  
  Future userRegistration() async{
  
    // Showing CircularProgressIndicator.
    setState(() {
    visible = true ; 
    });
  
    // Getting value from Controller
    String name = nameController.text;
    String email = emailController.text;
    String password = passwordController.text;
  
    // SERVER API URL
    var url = 'http://cafeliant.com/android-login/signupApi.php';
  
    var headers = {
        'content-type': 'application/json'
      };
    // Store all data with Param Name.
    var data = {'name': name, 'email': email, 'password' : password};
  
    // Starting Web API Call.
    var response = await http.post(url, body: json.encode(data),);
  
    // Getting Server response into variable.
    var message = jsonDecode(response.body);
    print(message);
  
    // If Web call Success than Hide the CircularProgressIndicator.
    if(response.statusCode == 200){
    setState(() {
      visible = false; 
    });
  }
  
    // Showing Alert Dialog with Response JSON Message.
    showDialog(
    context: context,
    builder: (BuildContext context) {
      return AlertDialog(
        title: new Text("message"),
        actions: &lt;Widget&gt;[
          FlatButton(
            child: new Text("OK"),
            onPressed: () {
              Navigator.of(context).push(MaterialPageRoute(builder: (context) =&gt; newS(),));
            },
          ),
        ],
      );
    },
    );
  
  }
  
  @override
  Widget build(BuildContext context) {
  return Scaffold(
    body: SingleChildScrollView(
      child: Center(
      child: Column(
        children: &lt;Widget&gt;[
  
          Padding(
            padding: const EdgeInsets.all(12.0),
            child: Text('User Registration Form', 
                    style: TextStyle(fontSize: 21))),
  
          Divider(),          
  
          Container(
          width: 280,
          padding: EdgeInsets.all(10.0),
          child: TextField(
              controller: nameController,
              autocorrect: true,
              decoration: InputDecoration(hintText: 'Enter Your Name Here'),
            )
          ),
  
          Container(
          width: 280,
          padding: EdgeInsets.all(10.0),
          child: TextField(
              controller: emailController,
              autocorrect: true,
              decoration: InputDecoration(hintText: 'Enter Your Email Here'),
            )
          ),
  
          Container(
          width: 280,
          padding: EdgeInsets.all(10.0),
          child: TextField(
              controller: passwordController,
              autocorrect: true,
              obscureText: true,
              decoration: InputDecoration(hintText: 'Enter Your Password Here'),
            )
          ),
  
          RaisedButton(
            onPressed: userRegistration,
            color: Colors.green,
            textColor: Colors.white,
            padding: EdgeInsets.fromLTRB(10, 10, 10, 10),
            child: Text('Click Here To Register User Online'),
          ),
  
          Visibility(
            visible: visible, 
            child: Container(
              margin: EdgeInsets.only(bottom: 30),
              child: CircularProgressIndicator()
              )
            ),
  
        ],
      ),
    )));
  }
  }
  </code></pre>
  
  <p>When sending responses from the app my requests are not going through and when printing the response i am getting a default response that says that i am not sending any requests.</p>