Step By Step Tutorial in Learning Flutter: Renaming Project and Module in Android Studio

Misterflutter
5 min readApr 20, 2020

--

In our previous article we made our small steps in creating our first Flutter application. In case you missed it go to My First Flutter Application

We are now moving to the second lesson, as we want to retain and see our progress on each lesson so in the future we can come back we will be requiring to saving them as different name.

So far as at this writing, there is no such thing like in Microsoft Word that we can just hit Save As and it will change the file name thus retaining the previous document.

Don’t worry, this was also my question, I did some research and happy to share how to do it so we can have our second lesson separated from the first but still continuing with the content of the first lesson.

Below was the final product of our first lesson

I highlighted the top window title bar, yours will be different as this is where you saved your project. In my case, the project is save under C:\FlutterProject\myMedium and the folder lesson01_hello_world

Navigate to your Windows File Explorer

Next, perform a right-click on the lesson01_hello_world folder, on the context menu click Copy

Then, right-click inside anywhere inside the white space window

On the context menu that will appear, click Paste

After the copy is finished, you will see lesson01_hello_world-Copy created

Right click the folder lesson01_hello_world-Copy then click Rename

Change it to lesson02_creating_new_project_from_existing then hit Enter key

If you have your first lesson still opened, click File menu then click Close Project

If been ask about terminating the main.dart click Terminate

On the next dialog box that will appear, choose Open an existing Android Studio project

Find the path where your lessons are located

Select lesson02_creating_new_project_from_existing

Click OK button

Drag the vertical dividing line between the left and right panel

Click the arrow down to expand the explorer

Right-click on the lesson02_creating_new_project_from_existing

Select Refractor then click Rename

Rename it to lesson02_creating_new_project_from_existing

Click OK button after

Right-click on the android [lesson01_hello_world_android]

Select Refractor then click Rename

Click Rename module

Click OK button

Type in lesson02_creating_new_project_from_existing_android

Click OK button

Pretty much the name should have changed now

Click arrow near the Project to expand

Click on Packages

The Packages should reflect the new name

Click the Green Arrow to Run

Note: You should select the virtual Android SDK device if it is not selected or empty as highlighted on screenshot below

You should see a successful Run without any error similar to below

The console tab highlighted below shows successful run without any Red error lines

Let us make changes on the main.dart

That is, changing the Text as shown below

import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter',
home: Scaffold(
appBar: AppBar(
title: Text('Lesson 02 Renaming Project and Modules'),
),
body: Center(
child: Text('This is the second lesson in Flutter'),
),
),
);
}
}

Click the Run button

Let us save the changes by going to File -> Save

When saving your application, Android Studio will perform a hot reload, which automatically refreshes the output from the emulator

Hot Reload is a very convenient way available in Flutter to see the changes made instantaneously

More information on Hot Reload in the upcoming articles so stay tune

That’s it for now until next time, hope you enjoy as much as I do

Tell me what you think, or if you have any questions let me know

In case you missed the first article My First Flutter Application

Thanks guys! :)

--

--

Misterflutter

The best free step by step online course in learning Flutter. Learn how to develop iOS or Android app through easy to follow instruction tutorials with images.