skip to Main Content
var tempDir = await getTemporaryDirectory();
String fullPath = "${tempDir.path}/boo2.pdf'";
print('full path $fullPath');    
File file = File(fullPath);
if (await file.exists() && Platform.isAndroid) 
   {
    
    } else {
          download2(dio, imgUrl, fullPath);
            }

Above code is used to download pdf file in flutter. If file exist in device then it should directly open it. and if it is not then it should download. Now the problem is I dont know how to open exist pdf.

2

Answers


  1. Most simple solution would be to use open_filex

    import 'package:open_filex/open_filex.dart';
    
    OpenFilex.open(fullPath);
    
    Login or Signup to reply.
  2. this will help you : open_file: ^3.2.1

    this is the link : https://pub.dev/packages/open_file

    you can open pdf by using this

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search