This article highlights the use of Flutter within the application XcodeFlutter 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 Server Plan is recommended for use with Flutter, as many dependencies that need to be installed separately may require sudo/admin privileges. Use Flutter with a Mac Server by obtaining a Dedicated Server Plan to quickly get started!


Note: For beginners who wish 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: 


  1. To begin, install Flutter on your user profile. This is done by running the following command within terminal and your home directory: 
    git clone https://github.com/flutter/flutter.git -b stable
    HTML


  2. Verify that your environment is properly setup. Flutter offers a tool called Doctor that will check this for you. Run the following command by adding Flutter to your PATH, sourcing your shell profile, then running the Flutter doctor command. Note, you must add the PATH to your respective shell profile.

    export PATH="$PATH:`pwd`/flutter/bin" >> ~/.bash_profile
    source ~/.bash_profile
    flutter doctor
    HTML
    HTML


  3. If you receive the following error when running Flutter Doctor, install the Android SDK Command-Line tools through Android Studio's SDK manager:

    After you have installed the Android SDK Command-Line tools to accept the necessary licenses, run the following command.

    flutter doctor --android-licenses
    HTML


  4. Once licenses are fully accepted, run flutter doctor and you should see a prompt similar to the image below.
     

  5. Now, setup your iOS simulator. To grab a list of existing iOS simulators, type the following command within your terminal.
    xcrun simctl list


  6. Choose a specific simulator by running the xcrun command to list all available simulators. Then, grab the specific $IOS_SIM_UDID and boot it using the command listed below.


    HTML\
    open -a '/Applications/Xcode.app/Contents/Developer/Applications/Simulator.app/Contents/MacOS/Simulator' --args -CurrentDeviceUDID $IOS_SIM_UDID
    HTML

    Note: If the specific simulator you wish to work with is not listed, please submit an installation request with our MacinCloud Support Help Desk.


    Here is an example:
    The image above is the partial output of the xcrun command. Grab the desired UDID from the xcrun command output, and run the following command to boot the desired simulator model.
    open -a '/Applications/Xcode.app/Contents/Developer/Applications/Simulator.app/Contents/MacOS/Simulator' --args -CurrentDeviceUDID 60EE4B5E-A4F7-4459-A4F8-ED612EABCFEE
    HTML

  7. Next, create your Flutter app with the following command. You may change the name of the app to whatever you like; we used "my_app" for the purpose of this tutorial. Change your directory to the directory that you wish to create your app in.

    flutter create my_app
    HTML

  8. Once completed, you should receive a prompt with the end statement, "All Done!".  Boot up your project path within terminal and type the following command:
    flutter run 
    HTML

    When this command is ran, the Flutter app will begin to compile within the Simulator that is currently booted.


  9. Next, open your Flutter application within Xcode. You may do this by running the following command within your Flutter app folder.

    open ios/Runner.xcworkspace
    HTML


  10. It is extremely important that you sign into your Apple ID to build your app directly to the simulator. You may do this by clicking on Runner > Signing & Capabilities > Team > Add Account. You must also add a unique Bundle Identifier under Team.

  11. You are now all set with your environment to begin developing iOS apps using Flutter.



    Note: For more information, please visit Flutters official documentation  https://flutter.dev/docs/get-started/install/macos