class ContactsList extends StatelessWidget { @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: const Text('Contacts'), backgroundColor: Theme.of(context).primaryColor, ), body: FutureBuilder<List>( initialData: [], future: Future.delayed(Duration(seconds: 1)).then((value) => findAll()), builder: (context, snapshot) { final contacts = (snapshot.data as List); return ListView.builder( itemBuilder: (context, index) { final Contact contact = contacts[index]; return _ContactItem(contact); }, itemCount: contacts.length, ); return Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: const [ CircularProgressIndicator(), Text('Loading') ],) ); }, ), floatingActionButton: FloatingActionButton( onPressed: () { Navigator.of(context) .push( MaterialPageRoute( builder: (context) => ContactForm(), ), ) .then( (newContact) => debugPrint( newContact.toString(), ), ); }, child: const Icon(Icons.add), ), ); } }
erro lista de contato