We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I am getting this issue when running the following code:
flutter: Available Ports: [COM3, COM6] flutter: written bytes: -1
(It sometimes states that written bytes is 1 at the start but then upon a hot restart it prints -1)
`import 'dart:convert'; import 'dart:typed_data'; import 'package:flutter/material.dart'; // import 'package:flutter_libserialport/flutter_libserialport.dart'; import 'package:libserialport/libserialport.dart'; void main() => runApp(MyApp()); class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { List<String> availablePort = SerialPort.availablePorts; print('Available Ports: $availablePort'); SerialPort port4 = SerialPort('COM6'); port4.openReadWrite(); try { print('written bytes: ${port4.write(_stringToUint8List("Hello"))}'); } on SerialPortError catch (err, _) { print(SerialPort.lastError); port4.close(); } return Container(); } } Uint8List _stringToUint8List(String s) { List<int> codeUnits = s.codeUnits; Uint8List uint8list = Uint8List.fromList(codeUnits); return uint8list; } class SerialPortExample extends StatefulWidget { @override _SerialPortExampleState createState() => _SerialPortExampleState(); } `
The text was updated successfully, but these errors were encountered:
Did you check return value of openReadWrite?
openReadWrite
Sorry, something went wrong.
No branches or pull requests
I am getting this issue when running the following code:
(It sometimes states that written bytes is 1 at the start but then upon a hot restart it prints -1)
The text was updated successfully, but these errors were encountered: