Dart SDK
源码位于 dart/。核心包 psdk_frame_father、psdk_device_adapter;命令包 psdk_fruit_cpcl、psdk_fruit_tspl、psdk_fruit_esc、psdk_fruit_rgb、psdk_fruit_wifi、psdk_fruit_emapi。按需使用 pub.dev 发布包并锁定版本;对齐本参考时使用固定源码中的本地 path 依赖,不能填写无效的 ^latest 版本。
dart/devices/ 包含 BLE、经典蓝牙、Windows 蓝牙、network、USB 等适配器。以各包 pubspec 和操作系统权限为准。经典蓝牙 discovered() 每次产生一个 ClassicBluetoothDevice,不是设备列表;connect() 返回 ConnectedDevice。断连由该设备处理。
命令构建示例
Section titled “命令构建示例”import 'dart:typed_data';import 'package:psdk_device_adapter/psdk_device_adapter.dart';import 'package:psdk_fruit_tspl/psdk_fruit_tspl.dart';
Uint8List buildLabel(ConnectedDevice device) { final tspl = TSPL.genericWithConnectedDevice(device); tspl .page(arg: TPage(width: 60, height: 40)) .cls() .text(arg: TText( x: 30, y: 40, xmulty: 1, ymulty: 1, isBold: false, content: 'Hello', )) .print(copies: 1); return tspl.command().binary();}参数、压缩与响应
Section titled “参数、压缩与响应”下面的完整索引按语言列出参数、默认值和命令构造。先检查生成字节,再按适配器写入;传输结果与打印完成分开确认。