The Mobile Protect SDK for Flutter supports the iOS and Android platforms. This document will take you through the steps to integrate the SDK into your project by adding a dependency via pub.dev. For other guides, check out Mobile Protect Installation Guides
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.
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:
dependencies: //... mobile_protect: ^23.0.0
Note: the latest version of the SDK can be seen here: https://pub.dev/packages/mobile_protect
Alternatively, you can run the following command in your project’s folder:
flutter pub add mobile_protect
Step 2: configure for Android
Follow steps 1-4 in Mobile Protect SDK for Android via Maven | Installing Mobile Protect SDK with Maven for v23 and above
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 atandroid/build.gradle
, both relative to the flutter project root.
Step 3: configure for iOS
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
andgit
when fetching the SDK.Add the following entry to the file at
~/.netrc
:machine mobile-protect-repos.securetheorem.com password {MOBILEPROTECT_REPO_API_KEY}
Replacing
{MOBILEPROTECT_REPO_API_KEY}
with the Mobile Protect API key.In the iOS project copy the
MobileProtect.plist
config file into the Flutter project's Xcode project, placing it in the project root, 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.