VOOZH about

URL: https://thenewstack.io/building-with-flutter-using-visual-studio-code-a-dev-guide/

⇱ Building With Flutter Using Visual Studio Code: A Dev Guide - The New Stack


TNS
SUBSCRIBE
Join our community of software engineering leaders and aspirational developers. Always stay in-the-know by getting the most important news and exclusive content delivered fresh to your inbox to learn more about at-scale software development.
REQUIRED
It seems that you've previously unsubscribed from our newsletter in the past. Click the button below to open the re-subscribe form in a new tab. When you're done, simply close that tab and continue with this form to complete your subscription.
The New Stack does not sell your information or share it with unaffiliated third parties. By continuing, you agree to our Terms of Use and Privacy Policy.
Welcome and thank you for joining The New Stack community!
Please answer a few simple questions to help us deliver the news and resources you are interested in.
REQUIRED
REQUIRED
REQUIRED
REQUIRED
REQUIRED
Great to meet you!
Tell us a bit about your job so we can cover the topics you find most relevant.
REQUIRED
REQUIRED
REQUIRED
REQUIRED
REQUIRED
Welcome!

We’re so glad you’re here. You can expect all the best TNS content to arrive Monday through Friday to keep you on top of the news and at the top of your game.

What’s next?

Check your inbox for a confirmation email where you can adjust your preferences and even join additional groups.

Follow TNS on your favorite social media networks.

Become a TNS follower on LinkedIn.

Check out the latest featured and trending stories while you wait for your first TNS newsletter.

PREV
1 of 2
NEXT
VOXPOP
As a JavaScript developer, what non-React tools do you use most often?
Angular
0%
Astro
0%
Svelte
0%
Vue.js
0%
Other
0%
I only use React
0%
I don't use JavaScript
0%
Thanks for your opinion! Subscribe below to get the final results, published exclusively in our TNS Update newsletter:
NEW! Try Stackie AI
From clobbered drafts to real-time sync
Apr 14th 2026 10:00am, by David Moore
TypeScript 6.0 RC arrives as a bridge to a faster future
Mar 14th 2026 9:00am, by Darryl K. Taft
Mastra empowers web devs to build AI agents in TypeScript
Jan 28th 2026 11:00am, by Loraine Lawson
2024-08-08 08:45:50
Building With Flutter Using Visual Studio Code: A Dev Guide
tutorial,
Programming Languages / Software Development

Building With Flutter Using Visual Studio Code: A Dev Guide

For Flutter developers, VS Code is able to offer a build and deployment scenario — allowing Flutter to focus on making good-looking apps.
Aug 8th, 2024 8:45am by David Eastman
👁 Featued image for: Building With Flutter Using Visual Studio Code: A Dev Guide
Image via Unsplash+. 
In my previous post, we looked at the construction of a small Flutter app. It was dense, but provided a very strong idea of how Flutter apps are constructed:
  • An overall stateless widget that is the app frame and code root.
  • The contents, which feels like building a responsive app with JSON and a CSS framework like Bootstrap.
  • Relatively simple events, listeners and state changes.
To round things off, I must approach this from a full developer perspective and actually build with it, as was our aim when comparing with Tauri. So it’s time to get started. I’m developing with a Mac, but not targeting iOS — just MacOS. There is a bit of extra work involved when targeting mobiles, which I won’t cover here. Looking at my options: 👁 Image
In the multitarget world, configurations need to be handled carefully — recommending iOS because I’m on a Mac is a stray signal, even if it is something many are interested in. Asking for 36GB space as a prerequisite is another cue that this is not a simple project, but an entire workflow. Cocoapods is also required, depending on your target. As expected, Visual Studio Code (or VS Code for short) is supported and recommended (as well as IntelliJ). Over the past year, I’ve felt the world tilt heavily toward VS Code. So I’ll start with VS Code, which needs to be version 1.77 or newer. Then, install the Flutter extension. 👁 Image
Remember, Flutter is written in Dart code. I can create a new project via the command palette, as we have done a few times before: 👁 Image
Slightly confusingly, it will then ask you to download the Flutter SDK or locate it. Doing this behind an IDE window isn’t ideal, as it could fail. As it is cloning, you’ll also need Git. So it might well be better to do this separately. I had issues from the “Flutter doctor” but they were mainly with versions and putting binaries on paths. It’s very easy to miss query windows within VS Code, however. I ran the “Flutter Doctor” within a VS Code shell after restarting to confirm if the issues had been fixed.
flutter doctor -v
When you are ready, with the New Project, choose Application and name it something appropriate. I mistakenly called my project namer_app,  thinking I was building something else. The template app is much simpler than the Sunflower example explained in my last post, but has the same structure. I hit build (F5 within Mac). 👁 Image
Eventually it ran the example app — which is a simple window, with a button and fully responsive. 👁 Image
It’s a MacOS app — it has an icon and the standard Mac window frame, but is running in debug mode. I already went over a much more complex example last week, so I’ll just summarize how the Dart code is organized. Structurally, the app is represented by a stateless widget. The stateful part, the MyHomePage class, holds the state — which we’ll need to deal with the button and events.
import 'package:flutter/material.dart'; 

void main() { 
 runApp(const MyApp()); 
} 

class MyApp extends StatelessWidget { 
 ... 
} 

class MyHomePage extends StatefulWidget { 
 ... 
 State<MyHomePage> createState() => _MyHomePageState(); 
} 

class _MyHomePageState extends State<MyHomePage> { 
 ... 
}
The MyApp class sets the color theme, creates the title, and creates the MyHomePage class with page title in purple.
class MyApp extends StatelessWidget { 

 const MyApp({super.key}); // This widget is the root of your application. 
 @override Widget build(BuildContext context) { 

 return MaterialApp( 
 title: 'Flutter Demo', 
 theme: ThemeData( 
 colorScheme: ColorScheme.fromSeed(
 seedColor: Colors.deepPurple), 
 useMaterial3: true, ), 
 home: const MyHomePage(title: 'Flutter Demo Home Page'), 
 ); 
 } 
}
The _MyHomePageState class has the responsibility to create the screen and increment the button:
class _MyHomePageState extends State<MyHomePage> { 
 int _counter = 0; 

 void _incrementCounter() { 
 setState(() { 
 _counter++; 
 }); 
 } 

 @override Widget build(BuildContext context) { 
 return Scaffold( 
 appBar: AppBar( 
 backgroundColor: Theme.of(context).colorScheme.inversePrimary, 
 title: Text(widget.title), 
 ), 
 body: Center( 
 child: Column( 
 mainAxisAlignment: MainAxisAlignment.center, 
 children: <Widget>[ 
 const Text( 'You have pushed the button this many times:',
 ), 
 Text( 
 '$_counter', 
 style: Theme.of(context).textTheme.headlineMedium, 
 ), 
 ], 
 ), 
 ), 
 floatingActionButton: FloatingActionButton( 
 onPressed: _incrementCounter, 
 tooltip: 'Increment', 
 child: const Icon(Icons.add), 
 ), 
 ); 
 } 
}
So the build method of the widget creates a Scaffold object, which holds the AppBar, a central Column with the Text and counter objects, and the button. The button clearly sets up the event listener _incrementCounter method, which moves the counter up one and announces a state change — forcing an update.  If I hover over the button, it does indeed show the text “Increment” as a tooltip. The debug app has been fully packaged, and the build result here can be run within the Application folder of my Mac: 👁 Image
To complete the picture, I need to build the app beyond debug mode. The launch configuration file launch.json appears to already have three configurations:
{
 "version": "0.2.0",
 "configurations": [
 {
 "name": "namer_app",
 "request": "launch",
 "type": "dart"
 },
 {
 "name": "namer_app (profile mode)",
 "request": "launch",
 "type": "dart",
 "flutterMode": "profile"
 },
 {
 "name": "namer_app (release mode)",
 "request": "launch",
 "type": "dart",
 "flutterMode": "release"
 }
 ]
}
Now, I realize that we need a task file, and one may exist, but VS Code tends to create one when you need it: 👁 Image
And indeed, if we use the recommended keyboard shortcut (Shift+Command+B), we do get a “release” build: 👁 Image
We now have a Release directory as a sister to the Debug directory. While running this app, we do indeed have a correctly packaged 46MB app that isn’t in debug mode: 👁 Image

Conclusion

There is quite a lot more within the different flavors of launch configuration and deployment; these can, for example, control what assets are included by Flutter within VS Code. You can also work on getting your app into the various app stores if that’s the road you need to take. Yet again, VS Code, while not astoundingly transparent in its actions, is able to offer a build and deployment scenario — allowing Flutter (in this case) to focus on making good-looking apps. We’ll see more of this combination more in the future.
TRENDING STORIES
David has been a London-based professional software developer with Oracle Corp. and British Telecom, and a consultant helping teams work in a more agile fashion. He wrote a book on UI design and has been writing technical articles ever since....
Read more from David Eastman
SHARE THIS STORY
TRENDING STORIES
SHARE THIS STORY
TRENDING STORIES
TNS DAILY NEWSLETTER Receive a free roundup of the most recent TNS articles in your inbox each day.
The New Stack does not sell your information or share it with unaffiliated third parties. By continuing, you agree to our Terms of Use and Privacy Policy.