onPressed property Null safety

VoidCallback? 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.

class Blacksmith extends StatelessWidget {
  const Blacksmith({Key? key}) : super(key: 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;