Flutter is a useful framework to utilize when developing both Android and iOS apps. Projects can be easily started within IDE's such as Visual Studio Code, Android Studio, and IntelliJ.
MacinCloud's Dedicated Sever Plan is recommended for use with Flutter, as many dependencies that need to be installed separately may require sudo/admin privileges. Try a Mac Server to use with Flutter by obtaining a Dedicated Server Plan to quickly get started!
If you are a beginner who wishes to try Flutter, you may try MacinCloud's Managed Server Plan with some limitations due to the lack of root/admin privileges.
Getting Started with Flutter:
- To Begin, open Android studio and install the Flutter plug-in.
- Within Android Studio, navigate to Preferences > Plug-ins
- Search "Flutter" within the Plug-ins search bar, and install it. The plug-in should look like the image below:
- Install the Android SDK tools. This will allow you to accept licenses when you are setting up your environment for Flutter.
- In Android Studio, go to Preferences > Appearance & Behavior > System Settings > Android SDK.
- Check, "Android SDK Command-line Tools(Latest)" and click apply on the bottom of the window.
- If this is your first time opening Android Studio, please go through the setup wizard and when you see a HAXM pop up, you may press cancel to complete the installation.
- Install Flutter on the server. This is done by running the following command within terminal and your home directory:
git clone https://github.com/flutter/flutter.git -b stable
Flutter offers a tool called Doctor that will check this for you. This tool will help verify that your environment is properly setup. You may run the following command by adding Flutter to your PATH or going to the following directory ~/flutter/bin
If you receive the following error:
Please run the following command after you have installed the Android SDK Command-Line tools through Android Studio. This is highlighted in step 2.
flutter doctor --android-licenses
We are now ready to start our first project. Open up Android Studio and click, "Create New Flutter Project". Set your Flutter path to the relative path to where you cloned the Github command. For this example, Flutter was downloaded to a MacinCloud server account home directory: /Users/<username>/flutter
Note: if the path is incorrect, you will see an error at the bottom stating, "Flutter SDK is not found in the specific location".
Set the location for your project, choose the languages of your preference for iOS and android. For this example, we used Swift and Kotlin. Finally, set your project name. It is important to note that all characters must be lowercase. When you startup your project, notice how you have a starter project with the material framework being imported for you. We are going to start off by working off the main.dart file. Lets create two child widgets, one will be to center the data, the other will be the widget that contains the data. '
child: Text("Hello World!")
The entire main.dart file should now look like the image below.
At the top Menu Bar, choose the simulator of your choice and run your application by hitting the run button. An iPhone simulator should populate with the text, "Hello world!", at its center.
Interested in MacinCloud Dedicated Servers?
Visit the Dedicated Server Plan page to obtain a Dedicated Server.