text
stringlengths 1
372
|
|---|
this can help you determine if an object fails to hit test.
|
this might happen if the object falls outside the bounds of its parent
|
and thus not considered for hit testing in the first place.
|
if you’re trying to debug compositor layers, consider using the following flags.
|
use the debugPaintLayerBordersEnabled flag to find the boundaries
|
of each layer. this flag results in outlining each layer’s bounds in orange.
|
use the debugRepaintRainbowEnabled flag to display a repainted layer.
|
whenever a layer repaints, it overlays with a rotating set of colors.
|
any function or method in the flutter framework that starts with
|
debug... only works in debug mode.
|
<topic_end>
|
<topic_start>
|
debug animation issues
|
info note
|
to debug animations with the least effort, slow them down.
|
to slow down the animation,
|
click slow animations in DevTools’ inspector view.
|
this reduces the animation to 20% speed.
|
if you want more control over the amount of slowness,
|
use the following instructions.
|
set the timeDilation variable (from the scheduler
|
library) to a number greater than 1.0, for instance, 50.0.
|
it’s best to only set this once on app startup. if you
|
change it on the fly, especially if you reduce it while
|
animations are running, it’s possible that the framework
|
will observe time going backwards, which will probably
|
result in asserts and generally interfere with your efforts.
|
<topic_end>
|
<topic_start>
|
debug performance issues
|
info note
|
you can achieve similar results to some of these debug
|
flags using DevTools. some of the debug flags provide little benefit.
|
if you find a flag with functionality you would like to add to DevTools,
|
file an issue.
|
flutter provides a wide variety of top-level properties and functions
|
to help you debug your app at various points along the
|
development cycle.
|
to use these features, compile your app in debug mode.
|
the following list highlights some of flags and one function from the
|
rendering library for debugging performance issues.
|
to set these flags either:
|
you can generate stack traces on demand as well.
|
to print your own stack traces, add the debugPrintStack()
|
function to your app.
|
<topic_end>
|
<topic_start>
|
trace dart code performance
|
info note
|
you can use the DevTools timeline events tab to perform traces.
|
you can also import and export trace files into the timeline view,
|
but only files generated by DevTools.
|
to perform custom performance traces and
|
measure wall or CPU time of arbitrary segments of dart code
|
like android does with systrace,
|
use dart:developer timeline utilities.
|
wrap the code you want to measure in timeline methods.
|
<code_start>
|
import 'dart:developer';
|
void main() {
|
Timeline.startSync('interesting function');
|
// iWonderHowLongThisTakes();
|
Timeline.finishSync();
|
}
|
<code_end>
|
to ensure that the runtime performance characteristics closely match that
|
of your final product, run your app in profile mode.
|
<topic_end>
|
<topic_start>
|
add performance overlay
|
info note
|
you can toggle display of the performance overlay on
|
your app using the performance overlay button in the
|
flutter inspector. if you prefer to do it in code,
|
use the following instructions.
|
to enable the PerformanceOverlay widget in your code,
|
set the showPerformanceOverlay property to true on the
|
MaterialApp, CupertinoApp, or WidgetsApp
|
constructor:
|
<topic_end>
|
<topic_start>
|
example 10
|
<code_start>
|
import 'package:flutter/material.dart';
|
class MyApp extends StatelessWidget {
|
const MyApp({super.key});
|
@override
|
widget build(BuildContext context) {
|
return MaterialApp(
|
showPerformanceOverlay: true,
|
title: 'my awesome app',
|
theme: ThemeData(
|
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
|
),
|
home: const MyHomePage(title: 'my awesome app'),
|
);
|
}
|
}
|
<code_end>
|
(if you’re not using MaterialApp, CupertinoApp,
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.