Originally published on bendyworks.com.
The start of any Flutter project involves installing the Flutter SDK and choosing an editor. I'll be using the Linux flavor of the SDK and Android Studio with the Flutter and Dart plugins installed.
Follow the linked instructions to install the Flutter SDK and set up the Android Emulator or iOS Simulator.
Once you have the SDKs installed run flutter doctor
to make sure everything is installed correctly. "Connected device" might fail if you don't currently have the emulator running.
$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel beta, v0.11.11, on Linux, locale en_US.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK 28.0.3)
[✓] Android Studio (version 3.2)
[✓] Connected device (1 available)
• No issues found!
~~~{% endraw %}
Now create the base app itself. {% raw %}`flutter create <name>`{% endraw %} is a handy command to do this.{% raw %}
~~~bash
$ flutter create birb
Creating project birb...
# truncated...
birb/.metadata (created)
birb/.gitignore (created)
birb/README.md (created)
Running "flutter packages get" in birb... 1.2s
Wrote 64 files.
All done!
[✓] Flutter is fully installed. (Channel beta, v0.11.11, on Linux, locale en_US.UTF-8)
[✓] Android toolchain - develop for Android devices is fully installed. (Android SDK 28.0.3)
[✓] Android Studio is fully installed. (version 3.2)
[✓] Connected device is fully installed. (1 available)
In order to run your application, type:
$ cd birb
$ flutter run
Your application code is in birb/lib/main.dart.
~~~{% endraw %}
One change I'll make here is renaming the {% raw %}`birb` directory to `app`. In the future I plan on having the project as a [monorepo](https://hackernoon.com/one-vs-many-why-we-moved-from-multiple-git-repos-to-a-monorepo-and-how-we-set-it-up-f4abb0cfe469) and include Firebase Functions code in a sibling directory.
Make sure that `flutter test` passes.
~~~bash
$ flutter test
00:03 +1: All tests passed!
~~~
If you haven't already, set up a virtual device to run the app in. Alternatively you could connect a real device.
![Android Studio Virtual Device Configuration](https://thepracticaldev.s3.amazonaws.com/i/sdify7hp691wcf3uz1gw.png)
[Run the generated app](https://flutter.io/docs/get-started/test-drive) in the Android Emulator (or iOS Simulator) to make sure the app works. For this series I'll be using a Pixel 2 profile with the Play Store. The running app should look something like this:
![Screenshot of sample app running in Android Emulator](https://thepracticaldev.s3.amazonaws.com/i/2vgpmckmnl0ig8vh9wbf.png)
Tomorrow I'll [work on configuring continuous integration](https://github.com/abraham/birb/issues/2) to make sure tests are always passing.
## Code changes
- [#4 Create initial app](https://github.com/abraham/birb/pull/4)
Top comments (23)
Hey @abraham ,
I'm having trouble getting started with flutter. I run
flutter create foo
, no issue.I then go into
foo
and runflutter run
, which gets the error listed below.I would appreciate your help if possible and whenever you can.
What happens when you run
flutter doctor
?By the way, running on an emulator seems to work fine from the command line.
I'll have to try again (now that I am at home and not on my work's network) and see if I can run it on my Android device.
Gave it a try, seems like it has to do with my work's network blocking the dependencies for gradle
Interesting. I'd recommend opening an issue with the Flutter team. That's something that
flutter doctor
should probably test for.Really nice introduction my friend. Flutter is one of my target frameworks to master in 2019. If you guys don't know yet - there is a Google Event 4/12 - developers.google.com/events/flutt... - probably worth seeing as they might announce some great features.
Yep! I'm looking forward to it and will be at the local Google Developer Group viewing party.
Thanks for the introduction. Do you have any experience comparing Android studio and VS Code for Flutter?
I am a game developer with little experience with non-games. I am considering starting Flutter for my future non-game projects (getting out of my comfort zone for the first time). I'm considering VS Code for its light-weight, convenience and familiarity to me. But I wonder if Android studio worths switching and learning a new tool?
Curious because I'm a C# game developer working on Visual Studio 2017. VS 2017 supports C# so nicely that I can't think of any other IDE workflow for C#. Is it similar for Flutter, or doesn't matter much?
I used Visual Studio Code with Flutter and It's works fine. I developed two apps, amazing.
Thank you. 2 apps is very promising.
I've been an Atom user for the last several years with only a little VS Code experience. I know a lot of Atom users switched to Code so I suspect they are fairly similar.
Android Studio feels a lot heavier to use then Atom. Almost all the keyboard shortcuts I'm used to are different so I find that difficult. I think that the integration with flutter and the Android Emulator are not as good for Code.
Thanks for the insight. I am pretty used to working on a plugged device from game dev, I'll probably keep going like that. Anyway, Android Studio looks huge and scary to me:)
It's got a lot of buttons and knobs but you can usually ignore most of it.
Hey, just looking to learn Flutter soon. Thanks for this. Am so00 tempted to start a similar series besides you but will take 2 weeks to play with Dart first.
Your series will serve both as an inspiration and guide for my own series. Thanks.
I think a similar series on learning Dart over two weeks would be very interesting too.
At the top of this post there is some unintuitive UI to switch to the other posts in the series.
You can also look at the bottom of canonical page and that will automatically update with a list of all posts.
I think that Flutter is the future of Mobile apps.
Great work Google!
Yep, Flutter is pretty great so far. It's still pretty early stages to so I'm interested how it'll evolve.
Hey @abraham ,
My computer cant handle the stress over running Android Emulator that is prepackaged with Android Studio. After googling, i found this GenyMotion android emulator that is lightweight. Have you tried using this as an external emulator?
I have not. It looks interesting though so I've put it on my list of things to explore.
Ya, I like the feature but that could use some user testing.
Hey, we'll take this all into consideration for updating the UI on our side. Thanks for bringing this up Ankush.
Some comments may only be visible to logged-in visitors. Sign in to view all comments.