Flutter is Google's UI toolkit for building beautiful, natively compiled applications for mobile, web, and desktop from a single codebase.
Flutter works with existing code, is used by developers and organizations around the world, and is free and open source.
In this lab, you will create a Flutter app using generated template code.
The basic Flutter interface provides a simple example to get started programming in Flutter.
What you'll learn
How to write a Flutter app that looks natural on iOS, Android, and the web
Basic structure of a Flutter app
Using multiple pages
Using hot reload for a quicker development cycle
Prerequisites
Based on the content, it is recommended to have some familiarity with:
Flutter
Dart
Task 1. Open the Code Server Editor
In this lab, you will use a custom editor that includes the Flutter and Dart extensions.
From the initial lab panel:
Copy the Flutter Editor address displayed.
Paste the Editor address into a Browser tab.
Task 2. Creating a Flutter template
In this section create a Flutter Web application called first_app.
Click the hamburger button (i.e. Left hand side, three horizontal lines ).
Open a Terminal within the browser by selecting New Terminal.
In the terminal enter the following command:
flutter create first_app
Move to the first_app directory:
cd first_app
Close the terminal window:
exit
The first_app directory and template code have now been created.
Task 3. Opening the new app
In this section explore the Flutter Web application called first_app.
Open the folder first_app.
Acknowledge the on-screen notifications.
At this point you will have the Flutter application open in the current workspace.
Task 4. Running the Flutter web application
In this section run the Flutter Web application from the command line.
In the editor, open a Terminal.
Ensure the terminal directory is set to first_app.
Run the Flutter web server:
fwr
The running web server should look similar to below:
Copy the Flutter Live Server address from the lab Panel.
Paste the address into a new browser tab.
The browser will render the web application e.g.
Note: Rendering of the web application can take up to ten seconds.
The view will show the application based on the code in the editor.
Feel free to interact with the running application.
Task 5. Adding boilerplate code
In this section, replace the Flutter starter code with the example for this lab.
Replace the contents of lib\main.dart with the code below:
Perform a hot restart to review the changes to the Flutter user interface.
Note: TabBar provides a tab interface in your application.
In the above code we add four tabs that will be used to show diffferent information. The tabs are functional and you can switch between them.
At this point you will be able to move between the pages using the onscreen navigation.
In the next section, we add a TabBarView to the application.
Task 8. Adding a TabBarView
Update the TabBarView setting referenced in the function MyDetails.
Find the following line(s) and uncomment the code (i.e. remove the // characters):
Perform a hot restart to review the changes to the Flutter user interface.
Note: TabBarView provides a view per tab defined. As the application has four tabs, we create four TabBarViews that represent a unique page for displaying tab information.
Now as the tabs are selected, the associated page view is displayed
In the next section, we add a Drawer to perform application navigation.
Task 9. Adding a drawer
Update the main menu icon to open a custom drawer in ProductHomeWidget.
Find the following line(s) and uncomment the code (i.e. remove the // characters):
Perform a hot restart to review the changes to the Flutter user interface.
Note: Now when the other options are selected the Details page will open.
Click Check my progress to verify the objective.
Assess my progress
Congratulations!
You have successfully completed the lab and demonstrated your knowledge of Flutter.
Over the course of this lab, you have performed the following tasks:
Used a TabBar and TabBarView widget
Added a Drawer to improve navigation
Learned to route to specific pages
This self-paced lab is part of the Flutter Essentials quest. A quest is a series of related labs that form a learning path. Completing this quest earns you a badge to recognize your achievement.
You can make your badges public and link to them in your online résumé or social media account. Enroll in this quest to get immediate credit for completing this lab. See other available quests.
Manual Last Updated September 19, 2022
Lab Last Tested January 17, 2022
Copyright 2025 Google LLC. All rights reserved. Google and the Google logo are trademarks of Google LLC. All other company and product names may be trademarks of the respective companies with which they are associated.
Labs create a Google Cloud project and resources for a fixed time
Labs have a time limit and no pause feature. If you end the lab, you'll have to restart from the beginning.
On the top left of your screen, click Start lab to begin
Use private browsing
Copy the provided Username and Password for the lab
Click Open console in private mode
Sign in to the Console
Sign in using your lab credentials. Using other credentials might cause errors or incur charges.
Accept the terms, and skip the recovery resource page
Don't click End lab unless you've finished the lab or want to restart it, as it will clear your work and remove the project
This content is not currently available
We will notify you via email when it becomes available
Great!
We will contact you via email if it becomes available
One lab at a time
Confirm to end all existing labs and start this one
Use private browsing to run the lab
Use an Incognito or private browser window to run this lab. This
prevents any conflicts between your personal account and the Student
account, which may cause extra charges incurred to your personal account.
In this lab you will create a Flutter app with a TabView to isolate data. Add navigation to the application to move directly to a page.