flutter 嵌入式 pos 打印机(如:Android Q2 设备)

Sye*_*san 5 posprinter flutter

我已经构建了一个 flutter 项目。现在我需要从 pos 嵌入式设备进行打印。我正在谷歌搜索,但没有得到任何解决方案。

\n

如果有任何解决方案请帮助我。

\n

实际上我需要Android Q2 设备

\n

安卓 Q2 设备\xc2\xa0

\n

Nis*_*n S 0

编辑:

对于您的情况,您可以下载公司提供的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)

参考:flutter 中的 Nativcode 示例

android添加第三方SDK