Quickstart in Flutter
Integrate the ARwayKit SDK with Flutter
In this quickstart guide, we will be integrating the ARwayKit SDK in the standard flutter app
Installed Versions
In this guide, we will be using the following versions of Flutter, Dart, and Unity:
Flutter version: 3.10.5
Dart version: 3.0.5
Unity: 2022.3.29f1 LST
Download the ARwayKit SDK
Steps
Download the ARwayKit SDK project from GitHub as a ZIP. You can contact us for access to the ARwayKit SDK.
Creating a Blank Project in Flutter
If you have already created a Flutter project, you may skip the installation instructions and proceed with the next steps. Otherwise, kindly refer to the Flutter documentation for installation guidelines.
flutter create my_project_name
Configure the Flutter Project
Steps
Open the
pubspec.yaml
file and add flutter_unity_widget to it under the dependencies section.dependencies: flutter_unity_widget: ^2022.2.0
Now inside your Dart code you can import it.
import 'package:flutter_unity_widget/flutter_unity_widget.dart';
After adding the dependencies, you need to fetch them into your Flutter project. You can fetch the dependencies by -
From the terminal: Run
flutter pub get
ORFrom Android Studio/IntelliJ: Click Packages get in the action ribbon at the top of
pubspec.yaml
.From VS Code: Click Get Packages located on the right side of the action ribbon at the top of
pubspec.yaml
.
Then add an import statement for using the package inside your Dart code.
Add the ARwayKit SDK to the Flutter Folder
Steps:
Download the Source code (zip) from the GitHub repo (unity-viewer-sdk-3.1.4.zip).
Extract the source code from the downloaded zip file by right-clicking on it and selecting "Extract All" or using a zip extraction tool of your choice.
In your Flutter app directory, create a new folder named "unity".
Move the extracted Unity project folder into the newly created "unity" folder. The expected path should be:
unity/unity-viewer-sdk-3.1.4/...
. ├── my_project_name │ └── .dart_tool │ └── .idea │ └── android │ └── ios │ └── lib │ └── linux │ └── macos │ └── test │ └── unity // Create this folder │ └── <Your Unity Project> // Example: unity-viewer-sdk-3.1.4 │ └── web │ └── windows
Make sure you have the Unity editor version 2022.3.29f1 installed on your computer. If you don't have it, download and install it from the official Unity website.
Open the Unity editor and navigate to the "unity-viewer-sdk-3.1.4" folder by selecting "Open Project" from the Unity editor's file menu and choosing the appropriate folder.
Before opening the project, ensure that you have the required modules downloaded and installed for both Android and iOS builds. If you haven't already, download and install the following modules in the Unity Hub:
Android Build Support
OpenJDK
Android SDK & NDK Tools
iOS Build Support
Once you have the required modules installed, open the Unity project by selecting it from the Unity Hub or by double-clicking on the Unity project file in the "unity-viewer-sdk-3.1.4" folder.
After opening the project, the Unity editor will start importing the necessary files, and a new Unity editor window will open, displaying the project's contents.
Update Addressables Groups & Set Account ID and Secret Key
Getting the Account ID and Secret Key
From the ARway Creator Portal, go to "For Developers -> Create a New App -> Enter App Name".
Copy your Account ID and SecretKey for that App.

Adding the Account ID and Secret Key
In the Project Window, go to "Assets -> ARway -> Viewer Mode -> Resource-> ARWayKitConfig " and add your credentials for the Account ID and Secret Key.

Switch Build Platform to Android or iOS.
"File -> Build Settings -> Build -> Select iOS/Android"
Updating the Addressables Groups
Navigate to "Window -> Asset Management -> Addressable -> Groups".
In the Addressables Groups window, click on "Build -> New Build -> Default Build Script".
Configure the flutter_unity_widget Package
Configuring the flutter_unity_widget can be done by following the instructions in their README.md, or by following the steps outlined below.
Steps
Download the fuw-2022.2.0.unitypackage file and place it into the Unity project folder.
The expected path is
unity/unity-viewer-sdk-3.1.4/fuw-2022.2.0.unitypackage
Using Unity, open the Unity project, go to File -> Build Settings -> Player Settings -> Settings for Android -> Other Settings and change the following under the Configuration section:
In Scripting Backend, change to IL2CPP
In Target Architectures, select ARMv7 and ARM64
File -> Build Settings -> Player Settings -> Settings for iOS -> Other Settings and change the following under the Configuration section:
In Scripting Backend, change to IL2CPP
In Target Device, choose iPhone Only
In Target SDK, choose Device SDK
After importing, click on Flutter and select the Export Android Debug or Export Android Release option (will export to android/unityLibrary) or the Export iOS Debug or Export iOS Release option (will export to ios/UnityLibrary).
To build for Android or iOS, follow the instructions below:
Sample Dart Files
We have created sample Dart files to help you get started quickly with the project.
How to use ARway SDK Scenes?
For how to use the scenes in the ARwayKit SDK, kindly look at the documentation for those scenes linked below.
ARWAY SDKBuild And Run:
Run the app on Android with the following command. For iOS, build an XCode project to deploy it to an iOS device from the IDE of your choice.
flutter run
Extras:
Here are some extra methods and APIs which you can implement to communicate to and from Unity using Flutter.
Props
fullscreen
(Enable or disable fullscreen mode on Android)disableUnload
(Disable unload on iOS when unload is called)
API
pause()
(Use this to pause unity player)resume()
(Use this to resume unity player)unload()
(Use this to unload unity player)quit()
(Use this to quit unity player)postMessage(String gameObject, methodName, message)
(Allows you invoke commands in Unity from flutter)onUnityMessage(data)
(Unity to flutter binding and listener)onUnityUnloaded()
(Unity to flutter listener when unity is unloaded)onUnitySceneLoaded(String name, int buildIndex, bool isLoaded, bool isValid,)
(Unity to flutter binding and listener when a new scene is loaded)
Last updated