Thanks to the renderercontext, I want to put a delete button on a column and this button will help to delete that row, but I couldn't find the right way. Can you help me?
My first approach
renderer: (rendererContext) {
return IconButton(
onPressed: () {
final row = stateManager.getRowByIdx(rendererContext.rowIdx);
stateManager.removeRows([row!]);
},
icon: Icon(
Icons.delete,
color: Colors.red.shade400,
),
);
},
but as you can guess "the instance member 'stateManager' can't be accesssed in an initializer.
Thanks to the renderercontext, I want to put a delete button on a column and this button will help to delete that row, but I couldn't find the right way. Can you help me?
My first approach renderer: (rendererContext) { return IconButton( onPressed: () { final row = stateManager.getRowByIdx(rendererContext.rowIdx); stateManager.removeRows([row!]); }, icon: Icon( Icons.delete, color: Colors.red.shade400, ), ); }, but as you can guess "the instance member 'stateManager' can't be accesssed in an initializer.
How can I achieve this behaviour ?