# Flutter integration

For simplicity, this guide will assume your Flutter app deploys to both iOS (Swift) and Android (Kotlin).

## Prerequisites

You must have the following installed:

* Android Studio, IntelliJ or Visual Studio Code.
* Flutter 3.32.5+ SDK
* Xcode 16.4+
* iOS SDKs and associated Simulators.
* AppfigurateSE macOS app.
* Appfigurate Simulator app installed into one or more iOS Simulators (use the [AppfigurateSE macOS](/appfigurate-se-user-guide/setup-ios-simulator-app.md) app for easy 1 click installation).
* Your iOS app must target iOS 15.0+ in order to include Appfigurate Flutter Plugin.

## Modify pubspec.yaml

In your app's `pubspec.yaml` add the following to the `dependencies` section:

```yaml
appfigurateflutter: ^4.0.2
```

Perform a `pub get` to ensure the Appfigurate Flutter Plugin is successfully installed.

## Update main.dart

In your apps `main.dart` file, initialize the Appfigurate Flutter Plugin:

> `main.dart` initialization example

```dart
import 'package:appfigurateflutter/appfigurateflutter.dart';

void main() async {  
    await AppfigurateLibrary.initialize();
    ...
```

## Create Dart APLNativeConfiguration subclass

In your app, add a new Dart class named `Configuration.dart`. Paste the following code:

> Dart Configuration example

```dart
import 'package:appfigurateflutter/appfigurateflutter.dart';

class Configuration extends APLNativeConfiguration { 
    factory Configuration() => _instance;
    
    static Configuration _instance = Configuration._internal();

    Configuration._internal();

    bool get debugLogging => nativeBool("debugLogging");
    String get serverUrl => nativeString("serverURL");
}
```

You can now use the `Configuration` class throughout your Flutter app as follows:

```dart
if (Configuration().debugLogging) ...
```

Now jump to [Flutter iOS](/getting-started/flutter-integration/flutter-ios.md).


---

# 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://docs.electricbolt.co.nz/getting-started/flutter-integration.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.
