BluetoothState.parse constructor

  1. @visibleForTesting
BluetoothState.parse(
  1. dynamic state
)

Implementation

@visibleForTesting
factory BluetoothState.parse(dynamic state) {
  switch (state) {
    case "STATE_OFF":
      return stateOff;
    case "STATE_TURNING_OFF":
      return stateTurningOff;
    case "STATE_ON":
      return stateOn;
    case "STATE_TURNING_ON":
      return stateTurningOn;
    case "STATE_UNKNOWN":
      return stateUnknown;
    case "STATE_RESETTING":
      return stateResetting;
    case "STATE_UNSUPPORTED":
      return stateUnsupported;
    case "STATE_UNAUTHORIZED":
      return stateUnauthorized;
  }

  return stateUnknown;
}