title: I am making a contacts book application but when I save contacts the name is not displayed
body: <p><strong>This my contacts list page</strong></p>
  <pre><code>class Contacts extends StatefulWidget with NavigationStates {
    @override
    _ContactsState createState() =&gt; _ContactsState();
  }
   class _ContactsState extends State&lt;Contacts&gt;{
     DatabaseHelper databaseHelper = DatabaseHelper();
     List&lt;contacts&gt; contactsList;
     int count = 0;
     @override
    Widget build(BuildContext context, ) {
       if(contactsList == 0){
         contactsList = List&lt;contacts&gt;();
         updateListView();
       }
      return Scaffold(
        resizeToAvoidBottomPadding: false,
        appBar: AppBar(
          title: Text(&quot;Contacts&quot;),
          backgroundColor: Colors.lightGreenAccent,
          centerTitle: true,
        ),
        body:  Column(
              children: &lt;Widget&gt;[
                 Container(
                  padding: EdgeInsets.all(4.0),
                  margin: EdgeInsets.all(5.0),
                  child: TextField(
                   //controller: searchController,
                    decoration: InputDecoration(
                      labelText:'Search Contacts',
                        border: new OutlineInputBorder(
                           borderRadius: BorderRadius.all(Radius.circular(25)),
                            borderSide: new BorderSide(
                          color: Colors.pinkAccent
                        )
                      ),
                        prefixIcon: Icon(
                         Icons.search,
                          color: Colors.black,
                        )
                    ),
                  ),
                ),
               Expanded(
                child: ListView.builder(
                  itemCount: count,
                  itemBuilder: (context , int position){
                    return  Card(
                      elevation: 1.0,
                      shape: RoundedRectangleBorder(
                        side: BorderSide(color: Colors.pinkAccent,width: 1),
                        borderRadius: BorderRadius.circular(20)
                      ),
                      child:  Container(
                        margin: EdgeInsets.all(6.0),
                        padding: EdgeInsets.all(4.0),
                        color: Colors.white,
                        child: ListTile(
                           leading:  CircleAvatar(
                             radius: 30.0,
                             backgroundColor: Colors.lightBlueAccent,
                             child: Icon(Icons.person,color: Colors.black,),
                           ),
                          title: Text(this.contactsList[position].first_name,style: TextStyle(color: Colors.black,fontSize: 28.0),),
                          subtitle: Text(this.contactsList[position].last_name,style:TextStyle(color: Colors.black38,fontSize: 15.0),),
                          trailing: GestureDetector(
                            child: Icon(Icons.delete, color: Colors.pinkAccent,),
                            onTap: () {
                              _delete(context, contactsList[position]);
                            },
                          ),
                        ),
                      ),
                    );
                  },
                ),
              )
              ],
            ),
        floatingActionButton: new FloatingActionButton(onPressed: null,
         child: new Icon(Icons.dialpad,color: Colors.black,size: 30,),
           backgroundColor: Colors.pinkAccent,
         ),
        bottomNavigationBar: CurvedNavigationBar(
          color: Colors.lightGreenAccent,
          backgroundColor: Colors.white,
          buttonBackgroundColor: Colors.pinkAccent,
          height: 50,
          index: 1,
          items:&lt;Widget&gt;[
            Icon(Icons.call,size: 25,color: Colors.black,),
            Icon(Icons.home,size: 30,color: Colors.black,),
            Icon(Icons.person_add_rounded,size: 25,color: Colors.black,),
          ],
          animationDuration: Duration(
              milliseconds: 400
          ),
          animationCurve: Curves.easeIn,
          onTap: (index) async {
            if (index == 0)
              Navigator.of(context).push(
                  MaterialPageRoute(
                      builder: (BuildContext context) {
                        return logs();
                      }
                  )
              );
            if (index == 1)
              Navigator.of(context).push(
                  MaterialPageRoute(
                      builder: (BuildContext context) {
                        return Contacts();
                      }
                  )
              );
            if (index == 2) 
           navigateToDetail(contacts('',''));
          }
        ),
      );
    }
    updateListView() {
       final Future&lt;Database&gt; dbFuture = databaseHelper.initalizeDatabase();
       dbFuture.then((database) {
         Future&lt;List&lt;contacts&gt;&gt; contactsListFuture = databaseHelper.getContactList();
         contactsListFuture.then((contactsList){
           setState(() {
             this.contactsList = contactsList;
             this.count = contactsList.length;
           });
         });
       });
    }
     Color getStorageColor() {
       int storage;
       switch (storage) {
         case 1:
           return Colors.pinkAccent;
           break;
         case 2:
           return Colors.lightBlueAccent;
           break;
           default:
           return Colors.lightBlueAccent;
       }
     }
     void navigateToDetail(contacts contact) async{
       bool result = await Navigator.push(context, MaterialPageRoute(builder: (context) {
         return AddContacts(contact);
       }));
  
       if (result == true) {
         updateListView();
       }
     }
     void _delete(BuildContext context, contacts contact) async {
  
       int result = await databaseHelper.deleteContact(contact.id);
       if (result != 0) {
         _SnackBar(context, 'Contact Deleted Successfully');
         updateListView();
       }
     }
     void _SnackBar(BuildContext context, String message) {
       final snackBar = SnackBar(
           content: Text(message),
          action: SnackBarAction(
         label: 'Undo',
            onPressed: (){},
       ),
       );
       // ignore: deprecated_member_use
       Scaffold.of(context).showSnackBar(snackBar);
     }
  }
  </code></pre>
  <p><strong>This is my contacts details page</strong></p>
  <pre><code> import 'dart:io';
      //import 'package:contacts_service/contacts_service.dart';
      import 'package:flutter/cupertino.dart';
      import 'package:flutter/material.dart';
      import 'package:image_picker/image_picker.dart';
      //import 'package:sqflite/sqflite.dart';
      import 'package:mycontacts_app/models/Contact.dart';
      import 'dart:async';
      import 'package:mycontacts_app/utils/database_helper.dart';
      //import 'package:intl/intl.dart';
      class AddContacts extends StatefulWidget {
         final contacts contact;
        AddContacts(this.contact);
        //AddContacts(contacts contact);
        @override
        State&lt;StatefulWidget&gt;  createState() {
          // _AddContactsState();
           return _AddContactsState(this.contact);
        }
      }
        class _AddContactsState extends State&lt;AddContacts&gt; {
         //TextEditingController _fnameController,_numberController,_lnameController;
          DatabaseHelper helper = DatabaseHelper();
          PickedFile _imageFile;
        final ImagePicker _picker = ImagePicker();
         _AddContactsState(this.contact);
      
         TextEditingController _fnameController = TextEditingController();
         TextEditingController _numberController = TextEditingController();
         TextEditingController _lnameController = TextEditingController();
      
      
        contacts contact;
        List _Storage = ['Phone','Sim'];
        //String _storageval;
        @override
        Widget build(BuildContext context) {
          //_nameController = contacts.first_name
          _fnameController.text = contact.first_name;
          _lnameController.text = contact.last_name;
          _numberController.text = contact.phone_no as String;
          return Scaffold(
            appBar: AppBar(
              title: Text(&quot;New Contact&quot;),
              backgroundColor: Colors.lightGreenAccent,
              centerTitle: true,
            ),
            body: SingleChildScrollView(
              child: Container(
                padding: EdgeInsets.symmetric(
                  vertical: 40.0,
                  horizontal: 10.0,
                ),
                //margin: EdgeInsets.all(15),
                child: Form(
                  child: Column(
                    //crossAxisAlignment: CrossAxisAlignment.start,
                    children: &lt;Widget&gt;[
                       Padding(
                        padding: const EdgeInsets.all(16.0),
                        child: Container(
                          padding: EdgeInsets.only(left: 16.0,right: 16.0),
                          decoration: BoxDecoration(
                            border: Border.all(
                              color: Colors.white
                            ),
                            borderRadius: BorderRadius.circular(20.0),
                          ),
                          child: DropdownButton(
                           hint: Text('Store In '),
                            dropdownColor: Colors.black12,
                            elevation: 5,
                            icon: Icon(Icons.arrow_drop_down),
                            iconSize: 20.0,
                            isExpanded: true,
                            style: TextStyle(
                              color: Colors.black,fontSize: 18.0
                            ),
                            items: _Storage.map((value){
                              return DropdownMenuItem(
                                value: value,
                                child: Text(value),
                              );
                            }).toList(),
                            value: getStorageAsString(contact.storage),
                            onChanged: (value){
                              setState(() {
                                //_storageval = value;
                                updateStorageAsInt(value);
                              });
                            },
                          ),
                        ),
                      ),
                     imageProfile(),
                      Padding(
                        padding: const EdgeInsets.all(8.0),
                        child: TextFormField(
                          controller: _fnameController,
                          onChanged: (value){
                            updateFirstname();
                          },
                          decoration: InputDecoration(
                            hintText: 'First Name',
                            prefixIcon: Icon(Icons.person),
                            //prefixText: &quot;Name&quot;,
                            suffixIcon: Icon(Icons.keyboard_arrow_down),
                            fillColor: Colors.white,
                            filled: true,
                            border: OutlineInputBorder(
                              borderRadius: BorderRadius.circular(20.0),
                            ),
                            contentPadding: EdgeInsets.all(15),
                          ),
                        ),
                      ),
                      Padding(
                        padding: const EdgeInsets.all(8.0),
                        child: TextFormField(
                          controller: _lnameController,
                          onChanged: (value){
                            updateLastName();
                          },
                          decoration: InputDecoration(
                            hintText: 'Last Name',
                            prefixIcon: Icon(Icons.person),
                            //prefixText: &quot;Name&quot;,
                            //suffixIcon: Icon(Icons.keyboard_arrow_down),
                            fillColor: Colors.white,
                            filled: true,
                            border: OutlineInputBorder(
                              borderRadius: BorderRadius.circular(20.0),
                            ),
                            contentPadding: EdgeInsets.all(15),
                          ),
                        ),
                      ),
                     // SizedBox(height: 15),
                      Padding(
                        padding: const EdgeInsets.all(8.0),
                        child: TextFormField(
                          controller: _numberController,
                          onChanged: (value){
                            //updateNumber();
                          },
                          decoration: InputDecoration(
                            hintText: 'Number',
                            prefixIcon: Icon(Icons.phone_android),
                            //prefixText: &quot;Name&quot;,
                            //suffixIcon: Icon(Icons.keyboard_arrow_down),
                            border: OutlineInputBorder(
                              borderRadius: BorderRadius.circular(20.0),
                            ),
                            fillColor: Colors.white,
                            filled: true,
                            contentPadding: EdgeInsets.all(15),
                          ),
                        ),
                      ),
                      //SizedBox(height: 15),
                      Padding(
                        padding: const EdgeInsets.all(8.0),
                        child: TextFormField(
                          //controller: _nameController,
                          decoration: InputDecoration(
                            hintText: 'Address',
                            prefixIcon: Icon(Icons.location_on_rounded),
                            //prefixText: &quot;Name&quot;,
                            suffixIcon: Icon(Icons.keyboard_arrow_down),
                            border: OutlineInputBorder(
                              borderRadius: BorderRadius.circular(20.0),
                            ),
                            fillColor: Colors.white,
                            filled: true,
                            contentPadding: EdgeInsets.all(15),
                          ),
                        ),
                      ),
                      //SizedBox(height: 15),
                      Padding(
                        padding: const EdgeInsets.all(8.0),
                        child: TextFormField(
                          //controller: _nameController,
                          decoration: InputDecoration(
                            hintText: 'Email',
                            prefixIcon: Icon(Icons.email),
                            //prefixText: &quot;Name&quot;,
                            //suffixIcon: Icon(Icons.keyboard_arrow_down),
                            border: OutlineInputBorder(
                              borderRadius: BorderRadius.circular(20.0),
                            ),
                            fillColor: Colors.white,
                            filled: true,
                            contentPadding: EdgeInsets.all(15),
                          ),
                        ),
                      ),
                      //SizedBox(height: 15),
                      Padding(
                        padding: const EdgeInsets.all(8.0),
                        child: TextFormField(
                         //controller: _nameController,
                          decoration: InputDecoration(
                            hintText: 'Website',
                            prefixIcon: Icon(Icons.language),
                            //prefixText: &quot;Name&quot;,
                            //suffixIcon: Icon(Icons.keyboard_arrow_down),
                            border: OutlineInputBorder(
                              borderRadius: BorderRadius.circular(20.0),
                            ),
                            fillColor: Colors.white,
                            filled: true,
                            contentPadding: EdgeInsets.all(15),
                          ),
                        ),
                      ),
                      //SizedBox(height: 15),
                      Padding(
                        padding: const EdgeInsets.all(8.0),
                        child: TextFormField(
                          //controller: _nameController,
                          decoration: InputDecoration(
                            hintText: 'Work Info',
                            prefixIcon: Icon(Icons.business),
                            //prefixText: &quot;Name&quot;,
                            //suffixIcon: Icon(Icons.keyboard_arrow_down),
                            border: OutlineInputBorder(
                              borderRadius: BorderRadius.circular(20.0),
                            ),
                            fillColor: Colors.white,
                            filled: true,
                            contentPadding: EdgeInsets.all(15),
                          ),
                        ),
                      ),
                    /*ListView.builder(
                      itemBuilder: (context, index){
                        return ExpansionTile(
                          title: ListTile(
                            title: TextField(
                              decoration: InputDecoration(
                                hintText: &quot;Name&quot;
                              ),
                               style: TextStyle(
                                 color: Colors.black,
                                 fontSize: 15.0,
                               ),
                            ),
                          ),
                          children: &lt;Widget&gt;[
                            ListTile(
                              title:TextFormField(
                                decoration: InputDecoration(
                                  hintText: &quot;Name Prefix&quot;
                                ),
                              )
                            ),
                            ListTile(
                                title:TextFormField(
                                  decoration: InputDecoration(
                                      hintText: &quot; First Name&quot;
                                  ),
                                )
                            ),
                            ListTile(
                                title:TextFormField(
                                  decoration: InputDecoration(
                                      hintText: &quot; Middle Name&quot;
                                  ),
                                )
                            ),
                            ListTile(
                                title:TextFormField(
                                  decoration: InputDecoration(
                                      hintText: &quot;Last Name&quot;
                                  ),
                                )
                            ),
                            ListTile(
                                title:TextFormField(
                                  decoration: InputDecoration(
                                      hintText: &quot;Name Suffix&quot;
                                  ),
                                )
                            )
                          ],
                        );
                      }
                    )*/
                    Padding(
                      padding: const EdgeInsets.only(top: 15.0, bottom: 15.0),
                      child: Row(
                        children: &lt;Widget&gt;[
                          Expanded(
                            child: RaisedButton(
                              color: Colors.lightGreenAccent,
                              textColor: Colors.black,
                              shape: RoundedRectangleBorder(
                                  borderRadius: BorderRadius.circular(18.0),
                                  side: BorderSide(color: Colors.pinkAccent),
                              ),
                              onPressed: () {
                                debugPrint(&quot;Save button clicked&quot;);
                                _save();
                              },
                              child: Text(
                                &quot;Save&quot;
                              ),
                            ),
                          ),
                          Container(width: 5.0,),
                          Expanded(
                            child: RaisedButton(
                              color: Colors.lightGreenAccent,
                              textColor: Colors.black,
                              shape: RoundedRectangleBorder(
                                borderRadius: BorderRadius.circular(18.0),
                                side: BorderSide(color: Colors.pinkAccent),
                              ),
                              onPressed: () {
                                _delete();
                              },
                              child: Text(
                                  &quot;Cancel&quot;
                              ),
                            ),
                          )
                        ],
                      ),
                    )
                    ],
                  ),
                ),
              ),
            ),
          );
        }
      Widget imageProfile() {
          return Center(
            child: Stack(
              children: &lt;Widget&gt;[
                CircleAvatar(
                  radius: 50.0,
                  backgroundImage: _imageFile==null? AssetImage(&quot;assets/default.png&quot;):FileImage(File(_imageFile.path)),
                ),
                Positioned(
                  bottom: 20.0,
                  right: 20.0,
                  child: InkWell(
                    onTap: () {
                      showModalBottomSheet(
                        context: context,
                        builder: ((builder) =&gt; bottomSheet()),
                      );
                    },
                    child: Icon(
                      Icons.camera_alt,
                      color: Colors.lightGreenAccent,
                      size: 28.0,
                    ),
                  ),
                ),
              ],
            ),
          );
      }
      Widget bottomSheet() {
          return Container(
            height: 100.0,
            width: MediaQuery.of(context).size.width,
            margin: EdgeInsets.symmetric(
              horizontal: 20,
              vertical: 20,
            ),
            child: Column(
              children: &lt;Widget&gt;[
                Text(
                  &quot;Choose Contact Image&quot;,
                  style: TextStyle(
                    fontSize: 20,
                  ),
                ),
                SizedBox(
                  height: 20,
                ),
                Row(
                  mainAxisAlignment: MainAxisAlignment.center,
                  children: &lt;Widget&gt;[
                   FlatButton.icon(
                     icon: Icon(Icons.camera),
                     onPressed: (){
                       takePhoto(ImageSource.camera);
                     },
                     label: Text(&quot;Camera&quot;),
                   ),
                    FlatButton.icon(
                      icon: Icon(Icons.image),
                      onPressed: (){
                        takePhoto(ImageSource.gallery);
                      },
                      label: Text(&quot;Gallery&quot;),
                    )
                  ],
                )
              ],
            ),
          );
      }
      void takePhoto(ImageSource source) async {
           final pickedFile = await _picker.getImage(
               source: source,
           );
           setState(() {
             _imageFile = pickedFile;
           });
      }
         void updateFirstname(){
           contact.first_name = _fnameController.text;
         }
         // Update the description of Note object
         void updateLastName() {
           contact.last_name = _lnameController.text;
         }
         /*void updateNumber() {
           contact.phone_no = _numberController.text as int;
         }*/
         void _save() async {
          moveToLastScreen();
           //n.date = DateFormat.yMMMd().format(DateTime.now());
           int result;
           if (contact.id != null) {  // Case 1: Update operation
             result = await helper.updateContact(contact);
           } else { // Case 2: Insert Operation
             result = await helper.insertContact(contact);
           }
           if (result != 0) {  // Success
             _showAlertDialog('Status', 'Contact Saved Successfully');
           } else {  // Failure
             _showAlertDialog('Status', 'Problem Saving Contact');
           }
         }
         void moveToLastScreen() {
           //Navigator.pop(context);
           Navigator.pop(context, true);
         }
         void _delete() async {
           moveToLastScreen();
           // Case 1: If user is trying to delete the NEW NOTE i.e. he has come to
           // the detail page by pressing the FAB of NoteList page.
           if (contact.id == null) {
             _showAlertDialog('Status','No Contact was deleted');
             return;
           }
           // Case 2: User is trying to delete the old note that already has a valid ID.
           int result = await helper.deleteContact(contact.id);
           if (result != 0) {
             _showAlertDialog('Status','Contact Deleted Successfully');
           } else {
             _showAlertDialog('Status', 'Error Occured while Deleting Contact');
           }
         }
          void _showAlertDialog(String title, String message) {
            AlertDialog alertDialog = AlertDialog(
              title: Text(title),
              content: Text(message),
            );
            showDialog(
                context: context,
                builder: (_) =&gt; alertDialog
            );
          }
         void updateStorageAsInt(String value) {
           switch (value) {
             case 'Phone':
               contact.storage = 1;
               break;
             case 'Sim':
               contact.storage = 2;
               break;
           }
         }
         // Convert int priority to String priority and display it to user in DropDown
         String getStorageAsString(int value) {
           String storage;
           switch (value) {
             case 1:
               storage = _Storage[0];  // 'High'
               break;
             case 2:
               storage = _Storage[1];  // 'Low'
               break;
           }
           return storage;
         }
      }
  </code></pre>
  <p>The contact card and icon is displayed but the name is not displaying.</p>
  <p>I was even getting error like :-
  <strong>This widget has been unmounted, so the State no longer has a context (and should be considered defunct).</strong></p>
  <p>It is not even showing the position or file of error
  And I am not being able to solve the error .</p>