CrossPT / flutter_plugin_pdf_viewer

A flutter plugin for handling PDF files. Works on both Android & iOS
BSD 3-Clause "New" or "Revised" License
92 stars 309 forks source link

'owner!._debugCurrentBuildTarget == this': is not true. #87

Open bchhabra2490 opened 3 years ago

bchhabra2490 commented 3 years ago

I am getting the error when I try to load the pdf from url. It shows the number of pages of pdf but then it crashes.

════════════════════════════════════════════════════════════════════════════════════════════════════
I/flutter (28488): ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
I/flutter (28488): The following assertion was thrown while rebuilding dirty elements:
I/flutter (28488): 'package:flutter/src/widgets/framework.dart': Failed assertion: line 4371 pos 14:
I/flutter (28488): 'owner!._debugCurrentBuildTarget == this': is not true.
I/flutter (28488):
I/flutter (28488): Either the assertion indicates an error in the framework itself, or we should provide substantially
I/flutter (28488): more information in this error message to help you determine and fix the underlying cause.
I/flutter (28488): In either case, please report this assertion by filing a bug on GitHub:
I/flutter (28488):   https://github.com/flutter/flutter/issues/new?template=BUG.md
I/flutter (28488):
I/flutter (28488): The relevant error-causing widget was:
I/flutter (28488):   PDFViewer
I/flutter (28488):   
lib/…/panSignatureScreens/pan_screen.dart:156
I/flutter (28488):
I/flutter (28488): When the exception was thrown, this was the stack:
I/flutter (28488): #2      Element.rebuild.<anonymous closure> 
package:flutter/…/widgets/framework.dart:4371
I/flutter (28488): #3      Element.rebuild 
package:flutter/…/widgets/framework.dart:4374
I/flutter (28488): #4      BuildOwner.buildScope 
package:flutter/…/widgets/framework.dart:2777
I/flutter (28488): #5      WidgetsBinding.drawFrame 
package:flutter/…/widgets/binding.dart:906
I/flutter (28488): #6      RendererBinding._handlePersistentFrameCallback 
package:flutter/…/rendering/binding.dart:309
I/flutter (28488): #7      SchedulerBinding._invokeFrameCallback 
package:flutter/…/scheduler/binding.dart:1117
I/flutter (28488): #8      SchedulerBinding.handleDrawFrame 
package:flutter/…/scheduler/binding.dart:1055
I/flutter (28488): #9      SchedulerBinding._handleDrawFrame 
package:flutter/…/scheduler/binding.dart:971
I/flutter (28488): #13     _invoke  (dart:ui/hooks.dart:251:10))
I/flutter (28488): #14     _drawFrame  (dart:ui/hooks.dart:209:3))

my usage - inside a Column(children:[])

new Expanded(
                  child: Container(
                    child: PDFViewer(
                      document: document,
                    ),
                    decoration: BoxDecoration(
                      border: Border.all(color: Colors.black),
                    ),
                  ),
                ),
rdunlocked18 commented 2 years ago

Same issue, Found Any Solution?

bchhabra2490 commented 2 years ago

https://stackoverflow.com/questions/64366500/flutter-owner-debugcurrentbuildtarget-this-is-not-true-87

rdunlocked18 commented 2 years ago

https://stackoverflow.com/questions/64366500/flutter-owner-debugcurrentbuildtarget-this-is-not-true-87

None of my Classes are Returning or Calling the Instance of Themself. But Yes the FCM Background Handler causes error here.

For Someone Else This might be helpful :

Future<void> initNotifs() async {
    FirebaseMessaging.onMessage.listen((RemoteMessage message) async {
      print("onMessage: $message");
    });
    final FirebaseMessaging messaging;
    messaging = FirebaseMessaging.instance;
    await messaging.getToken().then((c) => print(c));
    await messaging
        .subscribeToTopic('general')
        .then((value) => print('subscribed to general'));
     FirebaseMessaging.onBackgroundMessage(
         PushNotificationsHandler.firebaseMessagingBackgroundHandler);
  }

Comment the below part :

FirebaseMessaging.onBackgroundMessage(
         PushNotificationsHandler.firebaseMessagingBackgroundHandler);

Or just handle it in some other Page/View