Visual Studio Flutter



Flutter

  1. Visual Studio Code Flutter Setup
  2. Flutter Visual Code
  3. Visual Studio Code For Flutter
  4. Flutter Extension

From version 2.13.0 of Dart Code, emulators can be launched directly from within Visual Studio Code, but this feature relies on support from the Flutter tools which means it will only show emulators when using a very recent Flutter SDK. But really, it comes down to the fact that requiring Visual Studio put Flutter for Windows in the non free category for this platform which means any GUI toolkit that is free for Windows (for example Qt) has an advantage over Flutter regarding cost. How it will limits it growth is hard to evaluate. TahaTesser added the in triage label on Mar 9.

Contents
  • Get started
  • Flutter Layout Explorer
    • Using the Layout Explorer

Note: The inspector works with all Flutter applications.

What is it?

The Flutter widget inspector is a powerful tool for visualizing andexploring Flutter widget trees. The Flutter framework uses widgetsas the core building block for anything from controls(such as text, buttons, and toggles),to layout (such as centering, padding, rows, and columns).The inspector helps you visualize and explore Flutter widgettrees, and can be used for the following:

  • understanding existing layouts
  • diagnosing layout issues

Get started

To debug a layout issue, run the app in debug mode andopen the inspector by clicking the Flutter Inspectortab on the DevTools toolbar.

Note: You can still access the Flutter inspector directly from Android Studio/IntelliJ, but you might prefer the more spacious view when running it from DevTools in a browser.

Debugging layout issues visually

The following is a guide to the features available in theinspector’s toolbar. When space is limited, the icon isused as the visual version of the label.

Select widget mode
Flutter

Enable this button in order to select a widget on the device to inspect it. For more information, see Inspecting a widget.

Refresh tree
Reload the current widget info.
Slow Animations
Slow down animations to enable visual inspection.
Debug Paint
Add visual debugging hints to the rendering that display borders, padding, alignment, and spacers.
Paint Baselines
Cause each RenderBox to paint a line at each of its text baselines.
Repaint Rainbow
Shows rotating colors on layers when repainting.
Invert Oversized Images
Inverts oversized images in your running application.

Inspecting a widget

You can browse the interactive widget tree to view nearbywidgets and see their field values.

To locate individual UI elements in the widget tree,click the Select Widget Mode button in the toolbar.This puts the app on the device into a “widget select” mode.Click any widget in the app’s UI; this selects the widget on theapp’s screen, and scrolls the widget tree to the corresponding node.Toggle the Select Widget Mode button again to exitwidget select mode.

When debugging layout issues, the key fields to look at are thesize and constraints fields. The constraints flow down the tree,and the sizes flow back up. For more information on how this works,see Understanding constraints.

Flutter Layout Explorer

The Flutter Layout Explorer helps you to better understandFlutter layouts.

For an overview of what you can do with this tool, seethe Flutter Explorer video:

You might also find the following step-by-step article useful:

Using the Layout Explorer

From the Flutter Inspector, select a widget. The Layout Explorersupports both flex layouts and fixed size layouts, and hasspecific tooling for both kinds.

Flex layouts

When you select a flex widget (for example, Row, Column, Flex)or a direct child of a flex widget, the flex layout tool willappear in the Layout Explorer.

The Layout Explorer visualizes how Flex widgets and theirchildren are laid out. The explorer identifies the main axisand cross axis, as well as the current alignment for each(for example, start, end, and spaceBetween).It also shows details like flex factor, flex fit, and layoutconstraints.

Additionally, the explorer shows layout constraint violationsand render overflow errors. Violated layout constraintsare colored red, and overflow errors are presented in thestandard “yellow-tape” pattern, as you might see on a runningdevice. These visualizations aim to improve understanding ofwhy overflow errors occur as well as how to fix them.

Clicking a widget in the layout explorer mirrorsthe selection on the on-device inspector. Select Widget Modeneeds to be enabled for this. To enable it,click on the Select Widget Mode button in the inspector.

For some properties, like flex factor, flex fit, and alignment,you can modify the value via dropdown lists in the explorer.When modifying a widget property, you see the new value reflectednot only in the Layout Explorer, but also on thedevice running your Flutter app. The explorer animateson property changes so that the effect of the change is clear.Widget property changes made from the layout explorer don’tmodify your source code and are reverted on hot reload.

Interactive Properties

Layout Explorer supports modifying mainAxisAlignment,crossAxisAlignment, and FlexParentData.flex.In the future, we may add support for additional propertiessuch as mainAxisSize, textDirection, andFlexParentData.fit.

mainAxisAlignment

Supported values:

  • MainAxisAlignment.start
  • MainAxisAlignment.end
  • MainAxisAlignment.center
  • MainAxisAlignment.spaceBetween
  • MainAxisAlignment.spaceAround
  • MainAxisAlignment.spaceEvenly
crossAxisAlignment

Supported values:

  • CrossAxisAlignment.start
  • CrossAxisAlignment.center
  • CrossAxisAlignment.end
  • CrossAxisAlignment.stretch
FlexParentData.flex

Layout Explorer supports 7 flex options in the UI(null, 0, 1, 2, 3, 4, 5), but technically the flexfactor of a flex widget’s child can be any int.

Flexible.fit

Layout Explorer supports the two different types ofFlexFit: loose and tight.

Fixed size layouts

When you select a fixed size widget that is not a childof a flex widget, fixed size layout information will appearin the Layout Explorer. You can see size, constraint, and paddinginformation for both the selected widget and its nearest upstreamRenderObject.

Details Tree

Select the Details Tree tab to display the details tree for theselected widget.

From the details tree, you can gather useful information about awidget’s properties, render object, and children.

Track widget creation

Part of the functionality of the Flutter inspector is based oninstrumenting the application code in order to better understandthe source locations where widgets are created. The sourceinstrumentation allows the Flutter inspector to present thewidget tree in a manner similar to how the UI was definedin your source code. Without it, the tree of nodes in thewidget tree are much deeper, and it can be more difficult tounderstand how the runtime widget hierarchy corresponds toyour application’s UI.

Visual Studio Code Flutter Setup

You can disable this feature by passing --no-track-widget-creation tothe flutter run command.

Here are examples of what your widget tree might look likewith and without track widget creation enabled.

Track widget creation enabled (default):

Track widget creation disabled (not recommended):

This feature prevents otherwise-identical const Widgets frombeing considered equal in debug builds. For more details, seethe discussion on common problems when debugging.

Other resources

For a demonstration of what’s generally possible with the inspector,see the DartConf 2018 talk demonstrating the IntelliJ versionof the Flutter inspector.

Made by

Flutter is Google’s UI toolkit for building beautiful, natively compiled applications for mobile, web, and desktop from a single codebase.

Coming from another platform? Docs: iOS, Android, Web, React Native, Xamarin.

Fast Development

Emulator

Paint your app to life in milliseconds with Stateful Hot Reload. Use a rich set of fully-customizable widgets to build native interfaces in minutes.

Expressive and Flexible UI

Quickly ship features with a focus on native end-user experiences. Layered architecture allows for full customization, which results in incredibly fast rendering and expressive and flexible designs.

Native Performance

Flutter’s widgets incorporate all critical platform differences such as scrolling, navigation, icons and fonts, and your Flutter code is compiled to native ARM machine code using Dart's native compilers.

Try Flutter in your browser

Want more practice? Try a codelab.

Fast development

Flutter's hot reload helps you quickly and easily experiment, build UIs, add features, and fix bugs faster. Experience sub-second reload times without losing state on emulators, simulators, and hardware.

Learn more
Reflectly

An award winning mindfulness app built with Flutter.

Flutter Visual Code

Download: iOS, Android
Learn more

Expressive, beautiful UIs

Fallout 3 wanderers edition guide. Delight your users with Flutter's built-in beautiful Material Design and Cupertino (iOS-flavor) widgets, rich motion APIs, smooth natural scrolling, and platform awareness.

Browse the widget catalog

Native Performance

Flutter’s widgets incorporate all critical platform differences such as scrolling, navigation, icons and fonts to provide full native performance on both iOS and Android.

Demo design inspired by Aurélien Salomon's Google Newsstand Navigation Pattern Fast video uploader.

Learn from developers

Watch these videos to learn from Google and developers as you build with Flutter.

Visit our YouTube playlist

Who's using Flutter?

Organizations around the world are building apps with Flutter.

See what’s being created

Visual Studio Code For Flutter

Install Flutter today.

Flutter Extension

It’s free and open source.