printAndroid method

Future<void> printAndroid()

Implementation

Future<void> printAndroid() async {
  var scale = prefs.getInt('scale');
  var comments = prefs.getBool('comments');
  var interpretations = prefs.getBool('interpretations');
  var highlight = prefs.getBool('highlight');

  try {
    final String? result = await printChannel.invokeMethod(
        state.action == PrintAction.print ? 'printTest' : "shareTest",
        {
          "test": state.test.toJson(),
          "scale": '$scale',
          "comments": comments,
          "interpretations": interpretations,
          "highlight": highlight
        }
    );
    debugPrint("result : '$result'.");
    emit(state.copyWith(isLoadingPrint: false, isLoadingShare: false));
  } on PlatformException catch (e) {
    debugPrint("print : '${e.message}'.");
    emit(state.copyWith(isLoadingPrint: false, isLoadingShare: false));
  }
}