SfPdfViewer.asset constructor Null safety

SfPdfViewer.asset(
  1. String name,
  2. {Key? key,
  3. AssetBundle? bundle,
  4. bool canShowScrollHead = true,
  5. double pageSpacing = 4,
  6. PdfViewerController? controller,
  7. PdfZoomLevelChangedCallback? onZoomLevelChanged,
  8. bool canShowScrollStatus = true,
  9. PdfPageChangedCallback? onPageChanged,
  10. PdfDocumentLoadedCallback? onDocumentLoaded,
  11. bool enableDoubleTapZooming = true,
  12. bool enableTextSelection = true,
  13. PdfTextSelectionChangedCallback? onTextSelectionChanged,
  14. PdfDocumentLoadFailedCallback? onDocumentLoadFailed,
  15. bool enableDocumentLinkAnnotation = true,
  16. bool canShowPaginationDialog = true,
  17. Offset initialScrollOffset = Offset.zero,
  18. double initialZoomLevel = 1,
  19. PdfInteractionMode interactionMode = PdfInteractionMode.selection,
  20. PdfScrollDirection scrollDirection = PdfScrollDirection.vertical,
  21. PdfPageLayoutMode pageLayoutMode = PdfPageLayoutMode.continuous,
  22. Color searchTextHighlightColor = const Color(0xFFE56E00)}
)

Creates a widget that displays the PDF document obtained from an asset bundle.

class MyAppState extends State<MyApp>{
@override
void initState() {
  super.initState();
}

@override
Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        body: SfPdfViewer.asset(
          'assets/flutter-succinctly.pdf',
        ),
      ),
    );
  }
}

Implementation

SfPdfViewer.asset(String name,
    {Key? key,
    AssetBundle? bundle,
    this.canShowScrollHead = true,
    this.pageSpacing = 4,
    this.controller,
    this.onZoomLevelChanged,
    this.canShowScrollStatus = true,
    this.onPageChanged,
    this.onDocumentLoaded,
    this.enableDoubleTapZooming = true,
    this.enableTextSelection = true,
    this.onTextSelectionChanged,
    this.onDocumentLoadFailed,
    this.enableDocumentLinkAnnotation = true,
    this.canShowPaginationDialog = true,
    this.initialScrollOffset = Offset.zero,
    this.initialZoomLevel = 1,
    this.interactionMode = PdfInteractionMode.selection,
    this.scrollDirection = PdfScrollDirection.vertical,
    this.pageLayoutMode = PdfPageLayoutMode.continuous,
    this.searchTextHighlightColor = const Color(0xFFE56E00)})
    : _provider = AssetPdf(name, bundle),
      assert(pageSpacing >= 0),
      super(key: key);