How to not delete last element in array list? Since if user keep clicking on remove button, it will return to negative value if there is no element in it.
Row(
children: [
Column(
children: [
TextButton(child: const Text ('Click Me'),
onPressed: () {
setState((){
_listTexts.add(textController.text);
});
}),
],
),
Column(
children: [
TextButton(child: const Text ('Remove Me'),
onPressed: () {
setState((){
_listTexts.removeLast();
});
}),
])
],
),