# Integrate with Flutter Project

### Flutter Unity Widget

{% embed url="<https://github.com/juicycleff/flutter-unity-view-widget>" %}

This is an open-source project that helps developers to easily integrate Flutter Project with Unity. It includes simple interface to send message to Unity, receive message from Unity, and embed Unity Widget as a component of Flutter Project

### Configuration

Following steps are required to embed Unity inside your Flutter project

1. Open the *<mark style="color:purple;">`ios/Runner.xcworkspace`</mark>* (workspace, not the project) file in Xcode, right-click on the Navigator (not on an item), go to **Add Files to "Runner"** and add the *<mark style="color:purple;">`ios/UnityLibrary/Unity-Iphone.xcodeproj`</mark>* file.

<figure><img src="/files/Ff39aiYi34uelAsgPDhu" alt=""><figcaption><p>Unity-iPhone added</p></figcaption></figure>

2. Open the <mark style="color:purple;">`ios/Runner/AppDelegate.swift`</mark> file and change the following:

```swift
     import UIKit
     import Flutter
+    import flutter_unity_widget

     @UIApplicationMain
     @objc class AppDelegate: FlutterAppDelegate {
         override func application(
             _ application: UIApplication,
             didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
         ) -> Bool {
+            InitUnityIntegrationWithOptions(argc: CommandLine.argc, argv: CommandLine.unsafeArgv, launchOptions)

             GeneratedPluginRegistrant.register(with: self)
             return super.application(application, didFinishLaunchingWithOptions: launchOptions)
         }
     }
```

3. Add the <mark style="color:purple;">`UnityFramework.framework`</mark> file as a library to the Runner project

<figure><img src="/files/7QtA5L7149Qs2EYqQl6J" alt=""><figcaption><p>UnityFramework.framework added</p></figcaption></figure>

Even with these configurations, there might be a problem launching the application. Please refer to the section below to resolve problems.

{% content-ref url="/pages/si5HKIFu8Vn8hFR6oSMX" %}
[Trouble Shooting (Flutter Integration)](/products/sdk/for-ios-application/trouble-shooting-flutter-integration.md)
{% endcontent-ref %}

An example of Flutter-Unity integrated MYTY Avatar project can be found in the section below.

{% content-ref url="/pages/rqG6LlptUhwWQhKFFoBe" %}
[Flutter Example](/products/sdk/flutter-example.md)
{% endcontent-ref %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://myty.gitbook.io/products/sdk/for-ios-application/integrate-with-flutter-project.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
