πŸ“±Flutter Mobile SDK

This document is a guide to the example project included in the plugin files. In addition, following the below steps will help you learn how to add and use (eNROLL plugin) in your flutter application.

1. REQUIREMENTS

  • Minimum Flutter version 3.3.4

  • Android minSdkVersion 24

  • Kotlin Version 1.9.0

2. INSTALLATION

Run this command:

With Flutter:

 $ flutter pub add enroll_plugin

This will add a line like this to your package's pubspec.yaml (and run an implicit flutter pub get):

dependencies:
  enroll_plugin: ^1.0.0

2.1. Android

  • Add these lines in Build.gradle file:

maven { url 'https://jitpack.io' }
maven { url = uri("https://maven.innovatrics.com/releases") }
  • Upgrade minSdkVersion to in app/build.gradle.

  • Add the following lines to settings.gradle file:

buildscript {
    repositories {
        mavenCentral()
        maven {
            url = uri("https://storage.googleapis.com/r8-releases/raw")
        }
    }
    dependencies {
        classpath("com.android.tools:r8:8.2.24")
    }
}

2.2. iOS

  • add the following to your project info.plist file

	<key>NSCameraUsageDescription</key>
	<string>"Your Message to the users"</string>
	<key>NSLocationWhenInUseUsageDescription</key>
	<string>"Your Message to the users"</string>
	<key>NSAppTransportSecurity</key>
    	<dict>
        	<key>NSAllowsArbitraryLoads</key>
        	<true/>
    	</dict>

  • Add these two sources to the iOS project Podfile

source 'https://github.com/innovatrics/innovatrics-podspecs'
source 'https://github.com/CocoaPods/Specs.git'

2.3. Add a license file to your project:

  • For Android

  • For iOS

2.4. Run Command line:

flutter pub get


3. Import

import 'package:enroll_plugin/enroll_plugin.dart';

4. USAGE

  • Create a widget and just return EnrollPlugin widget in the build function as:

 return EnrollPlugin(
        mainScreenContext: context,
        tenantId: 'TENANT_ID',
        tenantSecret: 'TENANT_SECRET',
        enrollMode: EnrollMode.auth,
        enrollEnvironment: EnrollEnvironment.staging,
        localizationCode: EnrollLocalizations.en,
        onSuccess: () {
          // Delay the state change until after the build completes
          WidgetsBinding.instance.addPostFrameCallback((_) {
            debugPrint("Success");
          });
        },
        onError: (error) {
          // Delay the state change until after the build completes
          WidgetsBinding.instance.addPostFrameCallback((_) {
            debugPrint("Error: ${error.toString()}");
          });
        },
        onGettingRequestId: (requestId) {
          // Delay the state change until after the build completes
          WidgetsBinding.instance.addPostFrameCallback((_) {
            debugPrint("requestId:: $requestId");
          });
        },
        applicationId: 'APPLICATION_ID',
        skipTutorial: false,
        levelOfTrust: 'LEVEL_OF_TRUST_TOKEN',
        googleApiKey: 'GOOGLE_API_KEY',
      );

5. VALUES DESCRIPTION

Keys
Value

localizationCode

Select your language code enum value LocalizationCode.en for English, and LocalizationCode.ar if Arabic.

tenantId

Write your organization tenant id.

tenantSecret

Write your organization tenant secret.

mainScreenContext

Screen context

enrollCallback

Callback function to receive success, error, and getRequestID and response.

applicationId

Write your Application id.

skipTutorial

Choose to ignore the tutorial or not.

levelOfTrust

Write your Organization level of trust.

enrollMode

ONBOARDING, AUTH, UPDATE or FORGET_PROFILE_DATA

enrollEnvironment

Select the EnrollEnvironment: EnrollEnvironment.STAGING for staging and EnrollEnvironment.PRODUCTION for production.

googleApiKey

Google Api Key to view the user current location on the map.

Last updated