CPButton constructor

CPButton({
  1. required String image,
  2. required VoidCallback onPress,
  3. String? title,
  4. bool isEnabled = true,
  5. String? id,
})

Implementation

CPButton({
  required this.image,
  required this.onPress,
  this.title,
  this.isEnabled = true,
  String? id,
}) : uniqueId = id ?? const Uuid().v4() {
  if (uniqueId.trim().isEmpty ||
      image.trim().isEmpty ||
      (title != null && title!.trim().isEmpty)) {
    throw ArgumentError(
      'Button identifiers, images and supplied titles must not be empty.',
    );
  }
}