text stringlengths 1 372 |
|---|
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 overview |
in 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 |
text widget tries to be as wide as all the characters |
it needs to display. the self-determined width of the |
text widget then gets adopted by the column, which |
clashes with the maximum amount of horizontal space its parent, |
the row widget, can provide. |
how to fix it? |
well, you need to make sure the column won’t attempt |
to be wider than it can be. to achieve this, |
you need to constrain its width. one way to do it is to |
wrap the column in an expanded widget: |
<code_start> |
return const row( |
children: [ |
Icon(Icons.message), |
expanded( |
child: column( |
// code omitted |
), |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.