Sye*_*san 5 posprinter flutter
我已经构建了一个 flutter 项目。现在我需要从 pos 嵌入式设备进行打印。我正在谷歌搜索,但没有得到任何解决方案。
\n如果有任何解决方案请帮助我。
\n实际上我需要Android Q2 设备
\n\n编辑:
对于您的情况,您可以下载公司提供的SDK并编写本机代码来打印收据。
例子:
颤动中
static const platform = const MethodChannel('com.example.myapplication');
Future<void> _print() async {
try {
final bool result = await platform.invokeMethod('print',{"data":Printdata});
if (result) {
// success
} else {
// failed
}
} on PlatformException catch (e) {
//failed to print
}
}
Run Code Online (Sandbox Code Playgroud)
然后在Main.java/中Main.kt实现SDK文档中的方法
例子:
public void onMethodCall(MethodCall call, MethodChannel.Result result) {
if (call.method.equals("print")) {
data = call.argument("data");
// Code from SDK documentation
} else {
result.notImplemented();
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2234 次 |
| 最近记录: |