Flutter : NoSuchMethodError: The getter 'nom' was called on null. Receiver; null Tried calling: nom
alabiboo. The question was asked: Apr 06, 2020. 10:15
1 answer
I try to assign value to the attributes of the PanierModel but I receive this error on picture
NoSuchMethodError: The getter 'nom' was called on null. Receiver; null Tried calling: nom
class _TestSQFLITEState extends State<TestSQFLITE> { DatabaseHelper helper = DatabaseHelper(); PanierModel _panier; @override Widget build(BuildContext context) { setState(() { _panier.nom = _panier.nom == null ? "Arduino" : ""; }); void _ajouterPanier() async { int result; result = await helper.insertPanier(_panier); if(result != 0) print('STATUS Panier Save Successfully'); } return Scaffold( body: Container( child: Center( child: Column( children: <Widget>[ Text(_panier.nom , style: TextStyle(color: Colors.red, fontWeight: FontWeight.bold),), Text("Abibou", style: TextStyle(color: Colors.red, fontWeight: FontWeight.bold),), ], ), ), ), floatingActionButton: FloatingActionButton(onPressed: _ajouterPanier, child: Icon(Icons.add, color: Colors.white,),), ); } }