onPressed property

VoidCallback? get onPressed

Called when the user taps the chip.

If onPressed is set, then this callback will be called when the user taps on the label or avatar parts of the chip. If onPressed is null, then the chip will be disabled.

link
class Blacksmith extends StatelessWidget {
  const Blacksmith({super.key});

  void startHammering() {
    print('bang bang bang');
  }

  @override
  Widget build(BuildContext context) {
    return InputChip(
      label: const Text('Apply Hammer'),
      onPressed: startHammering,
    );
  }
}

Implementation

VoidCallback? get onPressed;