getSoftDeviceTypesFromString static method

SoftDeviceTypes getSoftDeviceTypesFromString(
  1. String sdtype
)

Implementation

static SoftDeviceTypes getSoftDeviceTypesFromString(String sdtype){
  for(int i = 0; i < SoftDeviceTypes.values.length; i++){
    if(SoftDeviceTypes.values[i].name.toLowerCase() == sdtype.toLowerCase()){
      return SoftDeviceTypes.values[i];
    }
  }
  String error = 'Valid Soft Device Types are: \n';
  for(int i = 0; i < SoftDeviceTypes.values.length; i++){
    error += '${SoftDeviceTypes.values[i].name}\n';
  }

  throw('Invalid Soft Device Type\n $error');
}