Already I have built a flutter project. Now I need to print from a pos embedded device. I am googling, but I don't get any solution.
Please help me if there is any solution.
Actually I need for Android Q2 device
Already I have built a flutter project. Now I need to print from a pos embedded device. I am googling, but I don't get any solution.
Please help me if there is any solution.
Actually I need for Android Q2 device
EDIT:
In your case, you can download the SDK provided by the company and write native code to print the receipt.
example:
in flutter
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
}
}
Then in the Main.java
/ Main.kt
implement the method from the SDK documentation
example:
public void onMethodCall(MethodCall call, MethodChannel.Result result) {
if (call.method.equals("print")) {
data = call.argument("data");
// Code from SDK documentation
} else {
result.notImplemented();
}
}
Try this library "flutter_bluetooth_serial" and connect to the printer via direct mac address like this:
BluetoothConnection connection = await BluetoothConnection.toAddress("mac");