print method

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

Implementation

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

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