littleGnAl / glance

An APM(Application Performance Monitoring) library for detecting UI jank in Flutter for mobile (Android/iOS) in production.
https://pub.dev/packages/glance
MIT License
19 stars 0 forks source link

Eliminate the GlanceStackTrace interface, and reuse the Dart's StackTrace interface #33

Closed littleGnAl closed 1 month ago

littleGnAl commented 1 month ago

The GlanceStackTrace interface is a specialized implementation representing the stack trace for the glance library. By reusing Dart’s StackTrace interface, it simplifies the integration of glance stack traces with other libraries that directly accept a StackTrace object as a parameter, such as Firebase’s recordError API, the user can report the jank stack trace like this:

class JankReportError extends Error {
  @override
  String toString() {
    return 'This only indicates jank, not an actual error.';
  }
}

class MyJankDetectedReporter extends JankDetectedReporter {
  @override
  void report(JankReport info) {
    FirebaseCrashlytics.instance.recordError(JankReportError(), info.stackTrace, fatal: false);
  }
}