Shirish Kadam
Shirish Kadam

Reputation: 747

Flutter Firebase Crashlytics reports stack trace as Java class files and not as Dart files

I have integrated Flutter Crashlytics in our app, but it is reporting crashes stack trace in Java class files and not in Dart files. So it is difficult to infer what is the file and line number where this issue occurred in the flutter codebase.

Here is an example of one such crash report from Firebase Crashltytics of an Uncaught exception:

Non-fatal Exception: java.lang.Exception: NoSuchMethodError: The method 'markNeedsBuild' was called on null.
Receiver: null
Tried calling: markNeedsBuild()
       at State.setState(State.java:1168)
       at _ArgonButtonState.initState.<fn>(initState.java:107)
       at AnimationLocalStatusListenersMixin.notifyStatusListeners(AnimationLocalStatusListenersMixin.java:193)
       at AnimationController._checkStatusChanged(AnimationController.java:773)
       at AnimationController._tick(AnimationController.java:789)
       at Ticker._tick(Ticker.java:237)
       at SchedulerBinding._invokeFrameCallback(SchedulerBinding.java:1102)
       at SchedulerBinding.handleBeginFrame.<fn>(handleBeginFrame.java:1017)
       at SchedulerBinding.handleBeginFrame(SchedulerBinding.java:1015)
       at SchedulerBinding._handleBeginFrame(SchedulerBinding.java:949)

Here is how Crashlytics is initialized:

// Pass all uncaught errors from the framework to Crashlytics.
FlutterError.onError = Crashlytics.instance.recordFlutterError;

runZoned(() {
    runApp(AppMain(homeWidget));
  }, onError: Crashlytics.instance.recordError);

I am reporting caught exceptions as such:

Crashlytics.instance.recordError(error, stack);

How can I configure Crashlytics to report stack trace in dart? Does Crashlytics show erroneous file names and line numbers for Dart source code?

Upvotes: 6

Views: 1411

Answers (2)

Dheeraj Avvari
Dheeraj Avvari

Reputation: 300

I would suggest to move on to Sentry. I am doing it for my app now. And while just testing it, I can say that sentry is much better than Crashlytics!

Upvotes: 0

Todd Burner
Todd Burner

Reputation: 2262

Todd from Crashlytics. This is a known behavior and we are looking into possible options moving forward. Kotlin users will see a similar behavior.

Upvotes: 7

Related Questions