flutter_pdf_share

Pub

Flutter plugin that allows you to show native share sheet or pdf viewer, both for IOS and Android

Usage

Add package as dependency to pubspec.yaml

dependencies:
  flutter_pdf_share: ^1.0.0

Then simply pass file path (might be in temp dir or somewhere else) to one the methods:

final data = await rootBundle.load('<some_asset.ext>');
final bytes = data.buffer.asUint8List();
final tempDir = await getTemporaryDirectory();
final file = File('${tempDir.path}/some_temp_name.pdf');
await file.writeAsBytes(bytes);

// to display share sheet
await FlutterPdfShare.share(file.path);

// to open preview
await FlutterPdfShare.view(file.path)

Complete example

Libraries

flutter_pdf_share