removeControl method

bool removeControl(
  1. SheetControl sheetControl
)

API to remove SheetControl.

Parameters: sheetControl SheetControl to be removed. The possible values are: AddressControl AmountBoxControl PlainTextControl

Return 'true', if successfully deleted . Otherwise, return 'false'.

exceptions Throws an ArgumentError if the sheetControl is null. Throws an ArgumentError if SheetControl type is Controltype.AMOUNTBOX or Controltype.ADDRESS.

Implementation

bool removeControl(SheetControl sheetControl){
  if (sheetControl.controltype == Controltype.AMOUNTBOX) {
    throw ArgumentError("AmountBoxControl must not be deleted.");
  } else if (sheetControl.controltype == Controltype.ADDRESS) {
    throw ArgumentError("AddressControl must not be deleted.");
  }
  if(sheetControls!.contains(sheetControl)){
    sheetControls!.remove(sheetControl);
    return true;
  }
  return false;
}