File tree Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -282,7 +282,6 @@ class _HomePageState extends State<HomePage> with WidgetsBindingObserver {
282282
283283 @override
284284 Widget build (BuildContext context) {
285- Pspdfkit .setupPlatformCallHandler ();
286285 Pspdfkit .flutterPdfActivityOnPause = () => flutterPdfActivityOnPauseHandler ();
287286 Pspdfkit .pdfViewControllerWillDismiss = () => pdfViewControllerWillDismissHandler ();
288287 Pspdfkit .pdfViewControllerDidDismiss = () => pdfViewControllerDidDismissHandler ();
Original file line number Diff line number Diff line change @@ -18,7 +18,15 @@ part 'configuration_options.dart';
1818
1919/// PSPDFKit plugin to load PDF and image documents on both platform iOS and Android.
2020class Pspdfkit {
21- static const MethodChannel _channel = const MethodChannel ('pspdfkit' );
21+ static MethodChannel _privateChannel = null ;
22+
23+ static MethodChannel get _channel {
24+ if (_privateChannel == null ) {
25+ _privateChannel = const MethodChannel ('pspdfkit' );
26+ _privateChannel.setMethodCallHandler (_platformCallHandler);
27+ }
28+ return _privateChannel;
29+ }
2230
2331 /// Gets the PSPDFKit framework version.
2432 static Future <String > get frameworkVersion async =>
@@ -119,8 +127,4 @@ class Pspdfkit {
119127 }
120128 return Future .value ();
121129 }
122-
123- static void setupPlatformCallHandler () {
124- _channel.setMethodCallHandler (_platformCallHandler);
125- }
126130}
You can’t perform that action at this time.
0 commit comments