logFrameIfChanged method

void logFrameIfChanged(
  1. WidgetsBinding binding,
  2. Duration timestamp
)

Implementation

void logFrameIfChanged(WidgetsBinding binding, Duration timestamp) async {
  // ignore: deprecated_member_use
  final Element? rootViewElement = binding.renderViewElement;

  if (initRapidFrameRate) {
    await getFrameRateConfiguration();
  }

  if (initEnvironment) {
    final RenderObject? rootObject = rootViewElement?.findRenderObject();

    if (rootObject != null) {
      screenWidth = rootObject.paintBounds.width.round();
      screenHeight = rootObject.paintBounds.height.round();

      if (screenWidth != 0 && screenHeight != 0) {
        initEnvironment = false;

        await PluginTealeaf.tlSetEnvironment(
            screenWidth: screenWidth, screenHeight: screenHeight);

        tlLogger.v('TlBinder, renderView w: $screenWidth, h: $screenHeight');
      }
    }
  }
}