Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The Mobile Protect SDK has a dedicated integration for for Flutter supports the iOS and Android apps built using Flutterplatforms. This document will take you through the steps to integrate the SDK into your build systemproject by adding a dependency via pub.dev. For other guides, check out Mobile Protect Installation Guides

To fetch the Mobile Protect SDK via Flutter, an In order for Mobile Protect Flutter to correctly fetch its dependencies a Mobile Protect API key is needed. If you haven’t received an API key for Mobile Protect, please contact us.

Preface

This will involve some steps on the Flutter side as well as some steps on both iOS and Android.

Flutter Integration

Add mobile_protect as a dependency in your pubspec.yaml file.

$ flutter pub add mobile_protect

...

Installation

Some steps are done in the pubspec.yaml file while some of them are done in the native iOS and Android configuration files.

Step 1: add MobileProtect as a dependency

Add the following entry to the pubspec.yaml file in your project:

Code Block
languageyaml
dependencies:
   //...
   mobile_protect: ^22^23.30.7

...

0

...

Note: the latest version of the SDK can be seen here: https://dartpub.dev/tools/pub/versioning for deciding if pinning the versions is the best practice for your project.

Android Integration

packages/mobile_protect

Alternatively, you can run the following command in your project’s folder:

Code Block
flutter pub add mobile_protect

Step 2: configure for Android

  1. Follow steps 1-4 in Mobile Protect SDK for Android via Maven

  2. In the Android project, create the xml directory (flutter_app/android/app/src/main/res/xml) if it does not exist. Then, copy the mobileprotect.xml config file into the xml resources folder.

iOS Integration

  1. Follow step 1 on Mobile Protect SDK for iOS via CocoaPods (cocoapods.org)| Installing Mobile Protect SDK with Maven for v23 and above

    1. Note that the settings.gradle of your flutter project is located at android/settings.gradle, while the build.gradle of your flutter project is located at android/build.gradle, both relative to the flutter project root.

Step 3: configure for iOS

  1. The API key is necessary to access the Podfile upon which Mobile Protect depends. This API key should be added to your netrc file, which will be used automatically by CocoaPods, curl and git when fetching the SDK.

    Add the following entry to the file at ~/.netrc:

    Code Block
    machine mobile-protect-repos.securetheorem.com
      password {MOBILEPROTECT_REPO_API_KEY}

    Replacing {MOBILEPROTECT_REPO_API_KEY} with the Mobile Protect API key.

  2. In the iOS project copy the MobileProtect.plist config file into the Flutter project's Xcode project, place placing it in the project root. See , and then add it to your xcode project - see Add Existing Files and Folders to a Project for instructions.

Installation of the SDK is now complete. No initialization of MobileProtect is necessary for flutter as the SDK will be initialized automatically.

Results

Please visit https://www.securetheorem.com/mobile/protect to see the list of your apps and the state of protection, along with the individual protection item details.