getBytes method

  1. @override
Future<Uint8List> getBytes(
  1. BuildContext context
)
override

Retrieves the bytes of the PDF document from the asset.

Implementation

@override
Future<Uint8List> getBytes(BuildContext context) async {
  if (_documentBytes == null) {
    final ByteData bytes = await ((_bundle != null)
        ? _bundle!.load(_pdfPath)
        : DefaultAssetBundle.of(context).load(_pdfPath));
    _documentBytes = bytes.buffer.asUint8List();
  }
  return Future<Uint8List>.value(_documentBytes);
}