title: How to change the app bar title in flutter
body: <pre><code>**change the appbar title dynamically**
  </code></pre>
  
  <p>Getting appbar title from the database and then I have to set to appbar. I am new to flutter tried setState as well.</p>
  
  <p>I have tried setState() as but still not working.
  how can i change the appbar text based on server response as well as database value </p>
  
  <blockquote>
  <pre><code>import 'dart:async';
  
  import 'package:flutter/material.dart'; 
  import 'package:parking_app/data/database_helper.dart'; 
  import'package:parking_app/models/user.dart';
  
  class HomeScreen extends StatefulWidget {   @override   State&lt;StatefulWidget&gt; createState() {
      return new HomeScreenState();   } }
  
  class HomeScreenState extends State&lt;HomeScreen&gt; {   @override   Widget build(BuildContext context) {
      var db = new DatabaseHelper();
      Future&lt;User&gt; user = db.getUser();
      String appBarTitle = "eClerx Parking";
      var appBarTitleText = new Text(appBarTitle);
  </code></pre>
    
    <blockquote>
  <pre><code>if (user != null) {
    user.then((val) {
      if (val == null) {
        return;
      }
      print(TAG+ "  user data : " + val.emailId);
      setState(() {
        build(context);
        appBarTitle = val.emailId;
      });
    });
  }
  </code></pre>
    </blockquote>
  
  <pre><code>return new MaterialApp(
    home: new Scaffold(
      appBar: new AppBar(
        title: appBarTitleText,
        actions: &lt;Widget&gt;[
          // action button
          new IconButton(
            icon: new Icon(Icons.settings_power),
            onPressed: () {
              _logout();
            },
          ),
          // action button
        ],
      ),
      body: new Padding(
        padding: const EdgeInsets.all(16.0),
        child: new ChoiceCard(choice: choices[0]),
      ),
    ),
  );   } }
  </code></pre>
  </blockquote>