'flutter embedded pos printer (Like: 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

Android Q2 device 



Solution 1:[1]

I have the same device and i already built flutter application , and ran into the same probleme . I contacted the company and they provided me with android sdk so i added a channel and called the print from the flutter code.

Solution 2:[2]

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();
    }
}

ref: Example Nativcode in flutter

Add third party SDK to android

Solution 3:[3]

Try this library "flutter_bluetooth_serial" and connect to the printer via direct mac address like this:

BluetoothConnection connection = await BluetoothConnection.toAddress("mac");

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 mohannad youssef
Solution 2 Tyler2P
Solution 3 Mauricio Oyanedel