Quando compilo e tento executar ele da erro Null check operator used on a null value, alguma forma de resolver isso!
class _FeedTransferState extends State { @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text('Transaction Feed'), ), body: FutureBuilder<List>( future: findAll(), builder: (context, snapshot){
switch(snapshot.connectionState){
case ConnectionState.none:
break;
case ConnectionState.waiting:
return Progress();
break;
case ConnectionState.active:
break;
case ConnectionState.done:
final List<Transaction> transactions = snapshot.data; **Aqui ele pede pra colocar o argumento ? indicando que pode ser null!**
return ListView.builder(
itemBuilder: (context, index) {
final Transaction transaction = transactions[index]; **Quando atribui o ?, aqui ele tbm pedi pra colocar que pode rececer null**
return Card(
child: ListTile(
leading: Icon(Icons.monetization_on),
title: Text(
transaction.value.toString(),
style: TextStyle(
fontSize: 24.0,
fontWeight: FontWeight.bold,
),
),
subtitle: Text(
transaction.contact.accountNumber.toString(),
style: TextStyle(
fontSize: 16.0,
),
),
),
);
},
itemCount: transactions.length,** Quando atribui o ?, aqui ele tbm pedi pra colocar que pode rececer null.**
);
break;
}
return Text('Unknown error');
}),
);
} }