David PHAM-VAN

Update example

@@ -64,13 +64,16 @@ class MyAppState extends State<MyApp> { @@ -64,13 +64,16 @@ class MyAppState extends State<MyApp> {
64 referenceBox.localToGlobal(referenceBox.paintBounds.bottomRight); 64 referenceBox.localToGlobal(referenceBox.paintBounds.bottomRight);
65 final Rect bounds = Rect.fromPoints(topLeft, bottomRight); 65 final Rect bounds = Rect.fromPoints(topLeft, bottomRight);
66 66
67 - final Printer printer = await Printing.pickPrinter(bounds: bounds);  
68 -  
69 - setState(() {  
70 - selectedPrinter = printer;  
71 - });  
72 -  
73 - print('Selected printer: $selectedPrinter'); 67 + try {
  68 + final Printer printer = await Printing.pickPrinter(bounds: bounds);
  69 + print('Selected printer: $selectedPrinter');
  70 +
  71 + setState(() {
  72 + selectedPrinter = printer;
  73 + });
  74 + } catch (e) {
  75 + print(e);
  76 + }
74 } 77 }
75 78
76 Future<void> _directPrintPdf() async { 79 Future<void> _directPrintPdf() async {