title: Value is retrieved only after hot reload in flutter from API
body: <p>I'm kinda new to flutter, I've been building app using rest API as the backend, whenever I try to load data to display on home page screen from GET API I'm not able to fetch the value until I reload or refresh the widget on the app after pushandreplacement from login screen. Please help me!!! already a week, I still stuck at that bugs.</p>
  <p>My code:</p>
  <pre><code>class HomePage extends StatefulWidget{
  
    final String name;
    HomePage(this.name);
  
    @override
    _HomePageState createState() =&gt; _HomePageState();
  }
  
  class _HomePageState extends State&lt;HomePage&gt;{
  
    String token;
  
    void iniState() {
      super.initState();
      GetRequest().getUserName(token);
    }
    
    Widget build(BuildContext context){
      return Scaffold(
        body: Container(
          alignment: Alignment.topCenter,
          child: SafeArea(
            child: bodyPage(context),
          ),
        ),  
      );   
    }
  }
  
  Widget bodyPage(BuildContext context) {
    
    return Scaffold(
      body: SafeArea(
        child: SingleChildScrollView(
          child: Container(
            padding: EdgeInsets.symmetric(horizontal: 20.0),
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: &lt;Widget&gt;[
                SizedBox(height: 15),
                _appBar(context),
              ],
            ),
          ),
        ),
      ),
    );
  }
  
    _appBar(context) {
  
      String myName = mData.fullname;
  
      return Row(
        children: &lt;Widget&gt;[
          CircleAvatar(
            backgroundImage: NetworkImage(
                &quot;https://jshopping.in/images/detailed/591/ibboll-Fashion-Mens-Optical-Glasses-Frames-Classic-Square-Wrap-Frame-Luxury-Brand-Men-Clear-Eyeglasses-Frame.jpg&quot;),
          ),
          SizedBox(width: 15),
          Text(&quot;Hello, &quot;, 
            style: TextStyle(
              fontWeight: FontWeight.bold,
              fontSize: 18,
            ),
          ),
          Text( 
            myName ?? 'KOOMPI',
              style: TextStyle(
                fontSize: 18,
                fontWeight: FontWeight.w600,
                color: Colors.blueAccent)),
        ],
      );
    }
  </code></pre>
  <p><strong>EDIT</strong></p>
  <p><strong>getUserName code:</strong></p>
  <pre><code>class GetRequest{
  
    String messageAlert;
  
    Future&lt;void&gt; getUserName(String _token) async {
      var response = await http.get(&quot;${ApiService.url}/dashboard&quot;, 
          headers: &lt;String, String&gt;{
          &quot;accept&quot;: &quot;application/json&quot;,
          &quot;authorization&quot;: &quot;Bearer &quot; + _token,
          //&quot;token&quot;: _token,
      });
      var responseBody = json.decode(response.body);
      mData = ModelUserData.fromJson(responseBody);
    }
    
  }
  </code></pre>
  <p><strong>Here is mData:</strong></p>
  <pre><code>class ModelUserData{
  
    String fullname;
  
    ModelUserData({
      this.fullname
    });
  
    ModelUserData.fromJson(Map&lt;String,dynamic&gt; parseJson){
      fullname = parseJson['full_name'];
    }
  
  }
    
  var mData = ModelUserData();
  </code></pre>