print method

  1. @override
Future<void> print({
  1. required GetnetPrintPayload printPayload,
})
override

Implementation

@override
Future<void> print({required GetnetPrintPayload printPayload}) async {
  try {
    final response = await methodChannel.invokeMethod<Map>('print', printPayload.toJson());

    if (response is Map) {
      if (response['code'] != GetnetStatusDeeplink.SUCCESS.name) {
        throw GetnetPrintException(message: response['message']);
      }
    } else {
      throw GetnetPrintException(message: 'invalid response');
    }
  } on GetnetPrintException catch (e) {
    throw GetnetPrintException(message: e.message);
  } on PlatformException catch (e) {
    throw GetnetPrintException(message: e.message ?? 'PlatformException');
  } catch (e) {
    throw GetnetPrintException(message: "Print Error: $e");
  }
}