title: How to Store a User ID after Login and access from another page in flutter?
body: <p>** API RESPONSE</p>
  <pre><code>{
  &quot;data&quot;: {
      &quot;CityName&quot;: null,
      &quot;DOB&quot;: &quot;7/07/2022&quot;,
      &quot;DeviceType&quot;: &quot;0&quot;,
      &quot;Email&quot;: &quot;test@gmail.com&quot;,
      &quot;MobileNo&quot;: &quot;1234567891&quot;,
      &quot;ProfileImage&quot;: &quot;&quot;,
      &quot;UserID&quot;: &quot;1&quot;,
      &quot;UserName&quot;: &quot;xyz&quot;,
      &quot;UserType&quot;: &quot;3&quot;
  },
  &quot;message&quot;: &quot;Successfully login&quot;,
  &quot;status&quot;: 200 
  }
  </code></pre>
  <p>// Api Services
  ````</p>
  <pre><code>Future&lt;Loginmodel?&gt; login() async {
      if (passwordController.text.isNotEmpty &amp;&amp; nameController.text.isNotEmpty) {
        var response = await http.post(
            Uri.parse(
              'XYZ',
            ),
            headers: {&quot;Content-Type&quot;: &quot;application/json&quot;},
            body: (jsonEncode({
              'UserName': nameController.text,
              'Password': passwordController.text,
              'DeviceToken': '',
              'DeviceType': ''
            })));
        if (response.statusCode == 200) {
          var data = jsonDecode(response.body);
  
          print(data);
  
          print(data['data']['UserID'].toString());
  
          if (data['data']['UserID'] == null) {
            ScaffoldMessenger.of(context)
                .showSnackBar(SnackBar(content: Text(&quot;Invaild Credentials&quot;)));
          } else {
            Navigator.push(
                context, MaterialPageRoute(builder: (context) =&gt; Homescreen()));
  
            ScaffoldMessenger.of(context)
                .showSnackBar(SnackBar(content: Text(&quot;Succesfully Credentials&quot;)));
          }
  
          // await Storage.write(key: &quot;token&quot;, value: output[&quot;token&quot;]);
        }
      } else {
        ScaffoldMessenger.of(context)
            .showSnackBar(SnackBar(content: Text(&quot;Black Field Not Allowed&quot;)));
      }
      }
  </code></pre>
  <pre><code></code></pre>