Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 [firebase_performance] Screen Rendering #11701

Open
FMorschel opened this issue Oct 13, 2023 · 3 comments
Open

🐛 [firebase_performance] Screen Rendering #11701

FMorschel opened this issue Oct 13, 2023 · 3 comments
Labels
platform: all Issues / PRs which are for all platforms. plugin: performance type: enhancement New feature or request

Comments

@FMorschel
Copy link

Screen Rendering

Some packages like https://pub.dev/packages/show_fps are out there, and they do a really interesting workaround to track FPS on the current Widget.

I don't know how this is handled, but could the API for the screen rendering be exposed on the package so that the actual developers could use something like this to track it? Or a mixin could be created like:

// Similar to what's calculated on `show_fps`
mixin FPSStateMixin<W extends StatefulWidget> on State<W> {
  Duration? _previous;
  Duration? _timing;

  @override
  void initState() {
    SchedulerBinding.instance.addPostFrameCallback(update);
    super.initState();
  }

  void update(Duration duration) {
    if (mounted && (ModalRoute.of(context)?.isCurrent ?? false)) {
      if (_previous != null) {
        _timing = duration - _previous!;
      }
      _previous = duration;
      if (_timing != null) {
        final fps = 1000 / _timing!.inMilliseconds;
        // Send the FPS data to Firebase Performance.
      }
      SchedulerBinding.instance.addPostFrameCallback(update);
    }
  }
}
@FMorschel FMorschel added Needs Attention This issue needs maintainer attention. type: enhancement New feature or request labels Oct 13, 2023
@darshankawar darshankawar added the triage Issue is currently being triaged. label Oct 16, 2023
@darshankawar
Copy link

Thanks for the report @FMorschel
Per documentation:

On Flutter, automatic screen rendering performance monitoring is not possible for individual Flutter screens. A single view controller encapsulates your entire Flutter application natively so the underlying native Firebase SDK is not aware of screen transitions.

Does this help to answer your question ?

@darshankawar darshankawar added blocked: customer-response Waiting for customer response, e.g. more information was requested. and removed Needs Attention This issue needs maintainer attention. labels Oct 16, 2023
@FMorschel
Copy link
Author

I'm aware of that documentation. I only wanted to ask here if you could expose an API for warning about screen transitions or even implement it with a RouteObserver like firebase_analytics.

@google-oss-bot google-oss-bot added Needs Attention This issue needs maintainer attention. and removed blocked: customer-response Waiting for customer response, e.g. more information was requested. labels Oct 16, 2023
@darshankawar
Copy link

Thanks for the feedback. Keeping it open for team's attention / tracking.

@darshankawar darshankawar added plugin: performance and removed Needs Attention This issue needs maintainer attention. triage Issue is currently being triaged. labels Oct 17, 2023
@Lyokone Lyokone added the platform: all Issues / PRs which are for all platforms. label Mar 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform: all Issues / PRs which are for all platforms. plugin: performance type: enhancement New feature or request
4 participants