title: getting current result from method inside another method
body: <p>am trying to call a method which calls another method .. and depending on that method result i will continue with my method .. something like this:</p>
  
  <pre><code>void submit() async{
  if (login) {
    ....
    bool result = await Login("966" + phone, _data.code);
    if (result) {
      successpage();
    } else {
      .....
    }
  </code></pre>
  
  <p>and login:</p>
  
  <pre><code>bool Login(String phone, String SMScode) {
  http.post(baseUrl + loginURL + "?phone=" + phone + "&amp;smsVerificationCode="+ SMScode,
    headers: {
      'content-type': 'application/json'
    }).then((response) {
  final jsonResponse = json.decode(Utf8Codec().decode(response.bodyBytes));
  print("LOGIN: " + jsonResponse.toString());
  Map decoded = json.decode(response.body);
  print(decoded['success']);
  if (decoded['success']) {
    globals.token = decoded['token'];
    globals.login = true;
  }else{
    globals.login = false;
  }
  });
  return globals.login;
  }
  </code></pre>
  
  <p>but this doesn't work and doesn't give me the result of the last bool i need .. how to solve this?</p>