init method

  1. @override
Future<bool> init()
override

Initializes the connection to the device.

Implementation

@override
	Future<bool> init() async {
  if (_controller.isClosed) throw StateError("A SerialDevice cannot be used after closeStream() is called");
  var result = false;
  try {
    result = await _port.init();
  } catch (error) { /* Ignore, log below */ }
  if (!result) logger.warning("Could not open serial port $portName");
  return result;
}