text
stringlengths
1
474
developer.android.com.<topic_end>
<topic_start>
iOS and macOS
You can find the following debugging resources on
developer.apple.com.<topic_end>
<topic_start>
Windows
You can find debugging resources on Microsoft Learn.
<topic_end>
<topic_start>Flutter's build modes
The Flutter tooling supports three modes when compiling your app,
and a headless mode for testing.
You choose a compilation mode depending on where you are in
the development cycle. Are you debugging your code? Do you
need profiling information? Are you ready to deploy your app?A quick summary for when to use which mode is as follows:The rest of the page details these modes.<topic_end>
<topic_start>
Debug
In debug mode, the app is set up for debugging on the physical
device, emulator, or simulator.Debug mode for mobile apps mean that:Debug mode for a web app means that:By default, flutter run compiles to debug mode.
Your IDE supports this mode. Android Studio,
for example, provides a Run > Debug… menu option,
as well as a green bug icon overlaid with a small triangle
on the project page.info Note<topic_end>
<topic_start>
Release
Use release mode for deploying the app, when you want maximum
optimization and minimal footprint size. For mobile, release mode
(which is not supported on the simulator or emulator), means that:Release mode for a web app means that:The command flutter run --release compiles to release mode.
Your IDE supports this mode. Android Studio, for example,
provides a Run > Run… menu option, as well as a triangular
green run button icon on the project page.
You can compile to release mode for a specific target
with flutter build <target>. For a list of supported targets,
use flutter help build.For more information, see the docs on releasing
iOS and Android apps.<topic_end>
<topic_start>
Profile
In profile mode, some debugging ability is maintained—enough
to profile your app’s performance. Profile mode is disabled on
the emulator and simulator, because their behavior is not representative
of real performance. On mobile, profile mode is similar to release mode,
with the following differences:Profile mode for a web app means that:Your IDE supports this mode. Android Studio, for example,
provides a Run > Profile… menu option.
The command flutter run --profile compiles to profile mode.info Note
Use the DevTools suite to profile your app’s performance.For more information on the build modes, see
Flutter’s build modes.
<topic_end>
<topic_start>Common Flutter errors
<topic_end>
<topic_start>
Introduction
This page explains several frequently-encountered Flutter
framework errors (including layout errors) and gives suggestions
on how to resolve them.
This is a living document with more errors to be added in
future revisions, and your contributions are welcomed.
Feel free to open an issue or submit a pull request to
make this page more useful to you and the Flutter community.<topic_end>
<topic_start>
‘A RenderFlex overflowed…’
RenderFlex overflow is one of the most frequently
encountered Flutter framework errors,
and you’ve probably run into it already.What does the error look like?When it happens, yellow and black stripes appear,
indicating the area of overflow in the app UI.
In addition, an error message displays in the debug console:How might you run into this error?The error often occurs when a Column or Row has a
child widget that isn’t constrained in its size.
For example,
the code snippet below demonstrates a common scenario:
<code_start>Widget build(BuildContext context) {
return Row(
children: [
const Icon(Icons.message),
Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('Title', style: Theme.of(context).textTheme.headlineMedium),
const Text(
'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed '
'do eiusmod tempor incididunt ut labore et dolore magna '
'aliqua. Ut enim ad minim veniam, quis nostrud '
'exercitation ullamco laboris nisi ut aliquip ex ea '
'commodo consequat.',
),
],
),
],
);
}<code_end>
In the above example,
the Column tries to be wider than the space the Row
(its parent) can allocate to it, causing an overflow error.
Why does the Column try to do that?
To understand this layout behavior, you need to know
how Flutter framework performs layout:“To perform layout, Flutter walks the render tree in a depth-first traversal
and passes down size constraints from parent to child… Children respond by
passing up a size to their parent object within the constraints the parent
established.” – Flutter architectural overviewIn this case, the Row widget doesn’t constrain the
size of its children, nor does the Column widget.
Lacking constraints from its parent widget, the second