Skip to content

User Guide: SDKs > Flutter SDK > Configuring the Flutter SDK

Configuring the Flutter SDK

Before using Volt Foundry APIs for Flutter, you must configure Volt MX Flutter SDK into your IDEs, such as Visual Studio Code/Android Studio. Configuring the Volt MX Flutter SDK involves the following steps:

Configuring Flutter SDK for the project

To configure the Flutter SDK for the project, follow these steps:

  1. Create a new Flutter Project

    flutter create my_voltmx_test_app
    cd my_voltmx_test_app
    

  2. Add Plugin Dependency

    1. Extract the downloaded HCLVoltFoundry-flutter-sdk.zip file.

    2. Copy this FlutterSDK into your Flutter project.

    3. Add local dependency in pubspec.yaml

    # pubspec.yaml
    dependencies:
    flutter:
        sdk: flutter
    voltmx_sdk_flutter:
        path: FlutterSDK/
    

  3. Install Dependencies

    flutter clean
    flutter pub get
    

  4. Configure Platform-Specific Settings

    Android Configuration

    1. android/app/build.gradle

      configurations.configureEach {
      exclude(group = "com.google.code.gson", module = "gson")
      }
      

    2. android/build.gradle

      maven {
      url = rootProject.projectDir.parentFile
      .resolve("FlutterSDK/android/local-maven-repo")
      .toURI()
      }
      

    3. In AndroidManifest.xml

      a) Add the code below inside the application tag

      tools:replace="android:label"
      

      b) All the below permissions

      <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
      <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
      <uses-permission android:name="android.permission.READ_PHONE_STATE" />
      <uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
      

      c) All the code snippets below

      <service
      android:name="com.kony.sdkcommons.Network.NetworkCore.KNYHttpJobIntentService"
      android:exported="false"
      android:permission="android.permission.BIND_JOB_SERVICE" />
      <service
      android:name="com.kony.sdkcommons.Network.NetworkCore.KNYHttpService"
      android:exported="false" />
      

iOS Configuration (ios/podfile)

platform: ios, '12.0'

# If using Firebase for messaging
pod 'Firebase/Core'
pod 'Firebase/Messaging'

Web Configuration (ios/podfile)

  1. In the Index.html file, add the following scripts in the body element
<script src="assets/packages/voltmx_sdk_flutter/assets/js/voltmx-sdk.js"></script>
<script src="assets/packages/voltmx_sdk_flutter/assets/js/config.js"></script>
<script src="assets/packages/voltmx_sdk_flutter/assets/js/constants.js"></script>