i want redirect my application when i pressed one of my colum, but i have a erroe in the onPressed() (): {Navigator.push () the "context" is not defined. but i dont know how pass context. maybe the solutions is easy but this is my first time working with flutter The mthod onPressed is in the first GestureDetectore(). class ProductDataGridSource extends DataGridSource { ProductDataGridSource(this.productList) { buildDataGridRow(); } late List<DataGridRow> dataGridRows; late List<Product> productList; @override DataGridRowAdapter? buildRow(DataGridRow row) { return DataGridRowAdapter(cells: [ GestureDetector( child: TextButton( style: TextButton.styleFrom( primary: Colors.blue, onSurface: Colors.blueAccent, ), onPressed: (){ Navigator.push( context, MaterialPageRoute(builder: (context) => const SecondRoute()), }, child: Text(row.getCells()[0].value.toString()), ), ), GestureDetector( onTap: (){ print(row.getCells()[1].value.toString()); }, child: TextButton( style: TextButton.styleFrom( primary: Colors.blue, onSurface: Colors.red, ), onPressed: null, child: Text(row.getCells()[1].value.toString()), ), ), ]); } Continue reading...