StatusFactory.fromString constructor

StatusFactory.fromString(
  1. String type
)

Implementation

factory StatusFactory.fromString(String type) {
  switch (type.toLowerCase()) {
    case 'connected':
      return StatusFactory(EmpaStatus.connected);
    case 'connecting':
      return StatusFactory(EmpaStatus.connecting);
    case 'disconnected':
      return StatusFactory(EmpaStatus.disconnected);
    case 'disconnecting':
      return StatusFactory(EmpaStatus.disconnecting);
    case 'discovering':
      return StatusFactory(EmpaStatus.discovering);
    case 'ready':
      return StatusFactory(EmpaStatus.ready);
    default:
      return StatusFactory(EmpaStatus.unknown);
  }
}