The Mobile Protect SDK for Flutter supports the has a dedicated integration for iOS and Android platformsapps built using Flutter. This document will take you through the steps to integrate the SDK into your project by adding a dependency via pub.devbuild system. For other guides, check out Mobile Protect Installation Guides
In order for To fetch the Mobile Protect Flutter to correctly fetch its dependencies a Mobile Protect SDK via Flutter, an 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
...
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
The project’s pubspec.yaml
should then contain the following entry:
Code Block | ||
---|---|---|
| ||
dependencies: //... mobile_protect: ^23^22.03.0 |
...
7 |
See https://pubdart.dev/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
...
tools/pub/versioning for deciding if pinning the versions is the best practice for your project.
Android Integration
Follow the steps on 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
:Code Block machine mobile-protect-repos.securetheorem.com password {MOBILEPROTECT_REPO_API_KEY}
Replacing
{MOBILEPROTECT_REPO_API_KEY}
with the Mobile Protect API key.In the Android project, create the
xml
directory (flutter_app/android/app/src/main/res/xml
) if it does not exist. Then, copy themobileprotect.xml
config file into thexml
resources folder.
iOS Integration
Follow step 1 on Mobile Protect SDK for iOS via CocoaPods (cocoapods.org)
In the iOS project copy the
MobileProtect.plist
config file into the Flutter project's Xcode project, placing place it in the project root, and then add it to your xcode project - see . See Add Existing Files and Folders to a Project for instructions.
...
.
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.