ConnectionEvent.fromString constructor

ConnectionEvent.fromString(String type)

Implementation

factory ConnectionEvent.fromString(String type) {
  switch (type) {
    case 'connected':
      return ConnectionEvent(ConnectionType.connected);
    case 'disconnected':
      return ConnectionEvent(ConnectionType.disconnected);
    case 'device_found':
      return ConnectionEvent(ConnectionType.device_found);
    case 'device_not_found':
      return ConnectionEvent(ConnectionType.device_not_found);
    default:
      return ConnectionEvent(ConnectionType.unknown);
  }
}