flutter project pdf run in android studio emulator but not run in phone what is the problem

26 Views Asked by At

I am try to make a pdf of some data, the pdf was make in android emulator but not make in android phone. how can i solved this problem.

I want pdf have run in phone like emulator. showMenu( context: context, position: const RelativeRect.fromLTRB(100,0, 0, 90),
items: [ PopupMenuItem( child: const Text( 'Group Wise Collection pdf', ), onTap: () async { up.pdfset(true);

                                                            var dir = (await getExternalStorageDirectory())?.path;

                                                            final bytes = await Printing.convertHtml(
                                                                format: PdfPageFormat.standard,
                                                                html: GroupWiseCollectionReport.GroupWiseCollectionTable(
                                                                  psR,
                                                                  up,
                                                                  psR.fromDate,
                                                                  psR.toDate,
                                                                  up.getbrnchName,
                                                                  kormiID ?? 'ALL',
                                                                  kName ?? '',
                                                                  getShomitiName ?? '',
                                                                  giD.toString(),
                                                                  psR.groupWiseColList,
                                                                ));

                                                            final file = File('$dir/pss_group_wise_coll_list.pdf');
                                                            await file.writeAsBytes(bytes);
                                                            up.pdfset(false);
                                                            if (!mounted) {
                                                              return;
                                                            }

                                                            Navigator.push(
                                                              context,
                                                              MaterialPageRoute(
                                                                builder: (_) => PdfPreviewPage(
                                                                  title: 'Group Wise Collection Report',
                                                                  bytes: bytes,
                                                                ),
                                                              ),
                                                            );
                                                          },
                                                        ),
                                                      ],
                                                    )
0

There are 0 best solutions below