title: show dialog when there is a problem in the internet network
body: <p>I mean when I log in, but the network to the database there is a problem, an information dialog will appear that the network has a problem. I'm confused about using else if here..</p>
  
  <pre><code>    _login() async {
      if (formKey.currentState.validate()) {
        formKey.currentState.save();
        try {
          final response = await UserController.login({
            "username": username,
            "password": password,
          });
  
          if (response != null &amp;&amp; response["success"]) {
            Http.setAccessToken(response["token"]);
  
            return Navigator.pushReplacement(
                context,
                MaterialPageRoute(
                  builder: (context) =&gt; MainActivity(),
                ));
          } else {
            await showDialog(
              context: context,
              builder: (BuildContext context) {
                return AlertDialog(
                  title: Text("Information"),
                  content: Text("Your account is not registered!"),
                  actions: &lt;Widget&gt;[
                    FlatButton(
                      child: Text("Close"),
                      onPressed: () {
                        Navigator.of(context).pop();
                      },
                    ),
                  ],
                );
              },
            );
          }
        } catch (e) {
          print(e.message);
        }
      }
    }
  </code></pre>
  
  <p>how do I put conditions if the network has a problem then return showDialog ??</p>