ConnectionEvent.fromString constructor

ConnectionEvent.fromString(
  1. 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);
  }
}