Mobile Flutter integration

For simplicity, this guide will assume your Mobile Flutter app deploys to both iOS and Android, and that your iOS native app is written in Swift, and your Android native app is written in Kotlin.

Prerequisites

You must have the following installed:

  • Android Studio, Intelli-J (Community Edition or Ultimate)

  • Flutter 3.10.0+ SDK

  • Xcode 15.2+

  • iOS SDKs and associated Simulators.

  • Android SDKs and associated Emulators.

  • AppfigurateSE macOS app.

  • Appfigurate Simulator app installed into one or more iOS Simulators (use the AppfigurateSE macOS app for easy 1 click installation).

  • Appfigurate Emulator app installed into one or more Android Emulators.

  • Your iOS app must target iOS 13.0+ in order to include Appfigurate Flutter Plugin.

  • Your Android app must have a minimum API level 26 (Android 8.0 Oreo) in order to include Appfigurate Flutter Plugin.

Modify pubspec.yaml

Note: Replace any references to quickstart with your own apps target name.

In your app's pubspec.yaml:

Add the following to the dependencies section:

appfigurateflutter: ^3.1.3

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

Output source code snippets

Under the DART/FLUTTER LIBRARY INTEGRATION section:

Tap Output implementation then tap Console.

Under the SWIFT/IOS LIBRARY INTEGRATION section:

Tap Output implementation then tap Console.

Tap Output Info.plist snippet then tap Console.

Under the KOTLIN/ANDROID LIBRARY INTEGRATION section:

Tap Output implementation then tap Console.

Tap Output AndroidManifest.xml snippet then tap Console.

The output will be displayed in Android Studio, under the Logcat tab. Filter the output to application nz.co.electricbolt.appfigurate.

Update main.dart

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

import 'package:appfigurateflutter/appfigurateflutter.dart';

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

Create Dart APLNativeConfiguration subclass

In your app, add a new Dart class, subclassing APLNativeConfiguration, called Configuration.

In your apps Configuration.dart file, paste the .dart implementation file output to the Console in Output source code snippets.

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");
}

Now jump to Flutter iOS.

Last updated