title: Flutter Registration with API
body: <p>I successfully can login with my API connection also can display the data in my app.</p>
  <p>I follow the same method for the registration to send data in API So that I can login.</p>
  <p>But the registration is not happening, although it didn't show any error.  My SnackBar showing <code>You are already registered</code> . But When I try to login <em>with the data which I provided in registration form, its showing user not found</em>( Obvious reason registration process didn't perform). Is there any problem with my API MODEL?</p>
  <p>Here is my Parameters</p>
  <pre><code> {
  
      &quot;Email&quot;:&quot;qwer@gmail.com&quot;,
      &quot;Mobile&quot;:&quot;1237891&quot;,
      &quot;Password&quot;:&quot;9991&quot;,
      &quot;RetypePassword&quot;:&quot;9991&quot;
  
  }
  </code></pre>
  <p>And here is the Json response</p>
  <pre><code> {
      &quot;Status&quot;: &quot;1&quot;,
      &quot;Message&quot;: &quot;You are registered successfully&quot;,
      &quot;UserData&quot;: {
          &quot;Name&quot;: &quot;qwer@gmail.com&quot;,
          &quot;EncUserId&quot;: &quot;IS0QOCrLby8Ft1kbkzn/mg==&quot;
      }
  }
  </code></pre>
  <p>After that I created a registration form, when user click the <code>Register</code> button it's run my API function <code>registrationOfuser()</code></p>
  <pre><code>Future &lt;void&gt; registrationOfuser(String  email, contact, pass,conpass) async{
      var jsonResponse ;
      Map data = {
        
        'Email': email,
        'Mobile': contact,
        'Password': pass,
        'RetypePassword': conpass,
      };
      print(data);
  
       String body = json.encode(data);
      var url = 'http://myurl/home/djkjkfjkjfwkjfkwjkjfkjwjfkwjfkwf';
      var response = await http.post(
        url,
        body: body,
        headers: {
          &quot;Content-Type&quot;: &quot;application/json&quot;,
          &quot;accept&quot;: &quot;application/json&quot;,
          &quot;Access-Control-Allow-Origin&quot;: &quot;*&quot;
        },
      );
  
      print(response.body);
      print(response.statusCode);
  
      if (response.statusCode == 200) {
         jsonResponse = json.decode(response.body.toString());
          ScaffoldMessenger.of(context)
            .showSnackBar(SnackBar(content:Text(&quot; ${jsonResponse['Message']}&quot;))) ;      
           
        //Or put here your next screen using Navigator.push() method
        print('success');
      } else {
        print('error');
      }
  
  
  
  }
  </code></pre>
  <p>And here is my MODEL</p>
  <pre><code>    class RegistrationApiResponse {
      RegistrationApiResponse({
          required this.status,
          required this.message,
          required this.userData,
      });
  
      String status;
      String message;
      //UserData userData;
      UserData? userData;
  
      factory RegistrationApiResponse.fromJson(Map&lt;String, dynamic&gt; json) =&gt; RegistrationApiResponse(
          status: json[&quot;Status&quot;],
          message: json[&quot;Message&quot;],
           userData: json[&quot;UserData&quot;] == null? null:UserData.fromJson(json[&quot;UserData&quot;] as Map&lt;String, dynamic&gt;),
          
         
  
  
  }
  
  class UserData {
      UserData({
          required this.name,
          required this.encUserId,
      });
  
      String name;
      String encUserId;
  
      factory UserData.fromJson(Map&lt;String, dynamic&gt; json) =&gt; UserData(
          name: json[&quot;Name&quot;],
          encUserId: json[&quot;EncUserId&quot;],
      );
  
  }
  </code></pre>