1 Star 0 Fork 0

fanchou / serial_port_flutter

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

A Flutter plugin integrated with Android-SerialPort-API.

This plugin works only for Android devices.

Usage

List devices

Future<List<Device>> findDevices() async {
  return await FlutterSerialPort.listDevices();
}

Create SerialPort for certain device

Device theDevice = Device("deviceName", "/your/device/path");
int baudrate = 9600;
Serial serialPort = await FlutterSerialPort.createSerialPort(theDevice, baudrate);

Open/Close device

bool openResult = await serialPort.open();
print(serialPort.isConnected) // true
bool closeResult = await serialPort.close();
print(serialPort.isConnected) // false

Read/Write data from/to device

// Listen to `receiveStream`
serialPort.receiveStream.listen((recv) {
  print("Receive: $recv");
});

serialPort.write(Uint8List.fromList("Write some data".codeUnits));

Example

Check out the example.

Issues

Build failed on Android

If you bump into a issue like below.

Change the android:label in AndroidManifest.xml.

Check out this commit fix: 🐛 Fix Android build failed issue

App crashed on Android x86

This is all about Android permission problem. Please check out Issue #4.

空文件

简介

A Flutter plugin integrated with Android-SerialPort-API 展开 收起
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Dart
1
https://gitee.com/fanchou/serial_port_flutter.git
git@gitee.com:fanchou/serial_port_flutter.git
fanchou
serial_port_flutter
serial_port_flutter
master

搜索帮助