title: How to insert a method into a future method in dart?
body: <p>I have a method of type Future when I call other methods in this method it does not recognize them.</p>
  <p>Here is my code:</p>
  <pre><code>      static Future&lt;void&gt; createUser(String email, String password, String role,
        {GlobalKey&lt;ScaffoldState&gt; scaffoldKey}) async {
         RestClient.getAuthToken().then((String token) {
        Map&lt;String, dynamic&gt; postData = {
      &quot;email&quot;: email,
      &quot;password&quot;: password,
      &quot;role&quot;: role
       };
  
      RestClient.procesPostRequest(&quot;user/add&quot;, postData, token)
        .then((Map&lt;String, dynamic&gt; data) {
      //String message;
      if (data.containsKey('error')) {
        // print('Error Data : $data');
        // message = WSErrorHandler.fromJson(data).getMessage();
        isNotRegisteredState();
        //return Future.value(message);
      } else {
        isRegisteredState();
      }
      });
      }).catchError((onError) {
     print('$onError');
     return Future.value('error');
    });
   }
  </code></pre>
  <p>These are the methods I call inside the future method:</p>
  <pre><code>     void isRegisteredState() {
        _isRegistered = true;
        notifyListeners();
       }
  
      void isNotRegisteredState() {
      _isRegistered = false;
      notifyListeners();
      }
  </code></pre>
  <p>And this is the error I get when I run the program:</p>
  <p><code>Error: Method not found: 'isNotRegisteredState'</code>, <code>Error: Method not found: 'isRegisteredState'</code></p>