Flutter SDK Integration
Introduction
This document serves as a comprehensive guide for Flutter developers to seamlessly integrate Nashid Verify SDK into their applications. By following the step-by-step instructions provided, developers can simplify the process of scanning Oman ID cards and passports, and efficiently retrieve document scan results.
Nashid Verify SDK is designed to streamline identity verification processes, ensuring a smooth integration experience across platforms.
Prerequisites
Flutter:
- Prerequisites:
- Latest Flutter SDK.
- Latest CocoaPods for iOS.
- Latest Android Studio with SDK tools.
- Gradle 8.0 or higher
- Xcode (16.1 or higher) for iOS development.
- iOS 16.0 or higher
- An IDE like Android Studio or VS Code with Flutter and Dart plugins.
- Recommendations:
- We recommend that you run flutter doctor to verify the setup.
- We recommend that you set up a real-device for testing.
- We recommend that you run flutter pub get to fetch plugin dependencies.
Installation
Flutter:
- Run this command:
flutter pub add nashid_verify_sdk
Note: Alternatively, you can update your pubspec.yaml
manually to include the package as the following:
dependencies:
nashid_verify_sdk: ^latest_version
- For iOS, Do the following:
- In iOS module’s
Info.plist
file: - In
Podfile
: - Enable Near Field Communication (NFC) Reading capability in your projects, as follows:
- Open your project in Xcode.
- Navigate to your Target settings.
- Go to the Signing & Capabilities tab.
- Click the + Capability button.
- Select Near Field Communication Tag Reading from the list.
- Add the following lines to your
ios/Runner/Runner.entitlements
file if your app uses both general NFC and ISO7816-based scanning: - Set Privacy Usage Description for NFC, as follows:
- In Xcode, go to the Build Settings tab.
- Search for Privacy - NFC Scan Usage Description.
- Double-click the field and add desired description, for example: "Needed permission to read Passport’s NFC"
- Run:
<key>NSCameraUsageDescription</key>
<string>We need access to the camera to scan documents</string>
<key>NFCReaderUsageDescription</key>
<string>NFC permission is required to complete the full KYC process.</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Location permission is required to complete the full KYC process.</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>Location permission is required to complete the full KYC process.</string>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>Location permission is required to complete the full KYC process.</string>
<key>com.apple.developer.nfc.readersession.iso7816.select-identifiers</key>
<array>
<string>A000000018524F500101</string>
<string>A0000002471001</string>
<string>A0000002472001</string>
<string>00000000000000</string>
<string>A00000024300130000000101</string>
<string>A0000002430013000000010109</string>
<string>A000000243001300000001FF</string>
</array>
# Update iOS deployment target
platform :ios, '16.0'
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
# --- Add these Lines ---
target.build_configurations.each do |config|
config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
end
# -------------------------
end
<key>com.apple.developer.nfc.readersession.formats</key>
<array>
<string>TAG</string>
<!-- Add ISO7816 only if your app uses both general NFC and ISO7816-based scanning -->
<string>ISO7816</string>
</array>
cd ios && pod install
- For Android, Do the following:
- Update
AndroidManifest.xml
: - Recommendation to use the following lines to app-level
build.gradle
file:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"> <!--Add this line in manifest tag-->
<!-- Add this attribute to the <application> tag -->
tools:replace="android:name"
android:enableOnBackInvokedCallback="true"
android {
compileSdk 36
defaultConfig {
minSdk 21
targetSdk 36
}
}
Usage
1. Import Nashid Verify SDK:
// Import this package to access all the required functions
import 'package:nashid_verify_sdk/nashid_verify_sdk.dart';
// Create an instance to access the SDK functions
final nashidVerifySdk = NashidVerifySdk();
2. Initialize Nashid Verify SDK:
To start using the SDK, you need to create an SDK Application and configure the desired verification flow via your admin dashboard.
The initialize()
function expects the following arguments:
- SDK Application Key (Mandatory): The key generated using your Nashid Verify admin dashboard.
- SDK Application Key Secret (Mandatory): The key secret generated using your Nashid Verify admin dashboard.
- Language Code (Optional):
en
for English (default),ar
for Arabic ..etc.
- Extra Data (Optional): An object of key-value pairs that you can use to annotate the verification data generated with additional data that your consumer application may need.
The initialize()
function returns a value, indicating whether initialization was successful (true
) or unsuccessful (false
), along with an error message in case of unsuccessful initialization.
// Create an instance to access the SDK functions
final nashidVerifySdk = NashidVerifySdk();
Map<String, dynamic> response = await _nashidIoPlugin.initialize(
sdkKey: "<your-sdk-key>",
sdkSecretKey: "<your-sdk-secret-key>",
languageId:"en",
extraData: { // optional
"example-key": "example-values",
}
);
3. Verify A Document Using Nashid Verify SDK
Once Nashid Verify SDK is initialized successfully, you can start verifications journeys for your users using the verify()
function.
This function expects an input argument specifying the type of document to be verified
This function expects an input argument specifying the type of document to be verified.
ID Type | Value |
OMANI_ID | 1 |
INTERNATIONAL_PASSPORT | 2 |
And as a result of the verification flow it returns three values:
- Result: A boolean flag that is true when the verification flow is successful, and false other wise.
- Error Message: A string contains the error details in case of unsuccessful verification.
- Verification ID: An ID of the created verification. This ID can be used later on to get the results collected with any additional checks/information annotated by backend services.
Example 1: Verify With Omani ID
Flutter:
Map<String, dynamic> response = _nashidIoPlugin.verify(ofType: NashidDocumentType.OMANI_ID);
Example 2: Verify With International Passport
Flutter:
Map<String, dynamic> response = _nashidIoPlugin.verify(ofType: NashidDocumentType.INTERNATIONAL_PASSPORT);
4. Using Nashid Verify SDK To Get A Verification Result
Once you have a valid verification ID as an outcome of a successful verification journey you can use getVerificationResult()
function to get the results collected with any additional checks/information annotated by backend services using the verification ID.
Example: Retrieve the data of verification ID abcd1234
Map<String, dynamic> response = await _nashidIoPlugin.getVerificationResult(
verificationId: "abcd1234",
);
- The
verificationID
(abcd1234) is just an example value that represents what we get as a result of the verify functionality.
- Example ID Card Response:
{
"data": {
"id": "dummy-id-12345",
"created_at": "2025-01-01T00:00:00.000000+00:00",
"updated_at": "2025-01-01T00:01:00.000000+00:00",
"updated_by": null,
"data": {
"NFC": {
"issue_date": "2020-01-01",
"expiry_date": "2030-01-01",
"date_of_birth": "1990-01-01",
"gender_arabic": "ذكر",
"gender_english": "Male",
"identity_number": "12345678",
"full_name_arabic": "اسم عربي تجريبي",
"full_name_english": "JOHN DOE",
"nationality_arabic": "تجريبي",
"nationality_english": "DUMMYLAND",
"place_of_issue_arabic": "مكان الإصدار",
"place_of_issue_english": "Dummy City",
"country_of_birth_arabic": "بلد الميلاد",
"country_of_birth_english": "Dummyland"
},
"scan": {
"gender": "MALE",
"country": "DUM",
"mrz_text": "IDDUM1234567<<0<<<<<<<<<<<<<<<9001011M3001011DUM<<<<<<<<<<<0JOHN<DOE<TEST<DUMMY",
"full_name": "JOHN DOE TEST DUMMY",
"document_no": "1234567",
"expiry_date": "2030-01-01",
"nationality": "DUM",
"date_of_birth": "1990-01-01",
"document_type": "ID"
},
"liveness": {
"active_liveness_confirmed": true,
"passive_liveness_confirmed": false
}
},
"metadata": {
"gender": "MALE",
"location": {
"latitude": 0.000000,
"longitude": 0.000000
},
"timestamp": "2025-01-01 00:00:00",
"app_version": "0.0.1 (000)",
"device_ipv4": "0.0.0.0",
"device_ipv6": "::1",
"device_type": "iPhone",
"system_name": "iOS",
"system_version": "0.0",
"device_identifier": "Dummy Device"
},
"artifacts": {
"nfc_face_image": "https://dummy.domain.com/nfc_face_image.jpg",
"ocr_face_image": "https://dummy.domain.com/ocr_face_image.jpg",
"back_side_image": "https://dummy.domain.com/back_side_image.jpg",
"front_side_image": "https://dummy.domain.com/front_side_image.jpg",
"active_liveness_image": "https://dummy.domain.com/active_liveness_image.jpg"
},
"annotations": {
"face_matching": {
"mode": "both",
"notes": "",
"is_successful": true
}
},
"type": {
"value": 1,
"title": "oman ID"
},
"status": {
"value": 3,
"title": "Verified"
},
"status_notes": [],
"nfc_collected": true,
"processing_time": "1.234 seconds"
},
"message": "verification retrieved successfully.",
"consolidated_message": "verification retrieved successfully.",
"details": {}
}
- Example Passport Response:
{
"data": {
"id": "dummy-id-12345",
"created_at": "2025-08-03T12:19:20.546556+00:00",
"updated_at": "2025-08-03T12:19:25.292090+00:00",
"updated_by": null,
"data": {
"NFC": {
"name": "JOHN DOE",
"gender": "Male",
"address": "123 DUMMY STREET, TEST CITY",
"telephone": "9999999999",
"issue_date": "2022-01-01",
"nationality": "DUM",
"date_of_birth": "1990-01-01",
"document_type": "Passport",
"place_of_birth": "TEST CITY",
"issuing_country": "Dummyland",
"passport_number": "DUM1234567",
"personal_number": "123456789",
"issuing_authority": "TEST OFFICE",
"passport_expiry_date": "2032-01-01"
},
"scan": {
"gender": "MALE",
"country": "DUM",
"mrz_text": "P<DUMDOE<<JOHN<<<<<<<<<<<<<<<<<<<DUM1234567DUM9001019M3201011123456789<<<<<<<<<00",
"full_name": "DOE JOHN",
"document_no": "DUM1234567",
"expiry_date": "2032-01-01",
"nationality": "DUM",
"date_of_birth": "1990-01-01",
"document_type": "Passport"
},
"liveness": {
"active_liveness_confirmed": true,
"passive_liveness_confirmed": false
}
},
"metadata": {
"gender": "MALE",
"location": {
"latitude": 0.000000,
"longitude": 0.000000
},
"timestamp": "2025-08-03 12:19:19",
"app_version": "0.0.0 (000)",
"device_ipv4": "0.0.0.0",
"device_ipv6": "::1",
"device_type": "iPhone",
"system_name": "iOS",
"system_version": "0.0",
"device_identifier": "Dummy Device"
},
"artifacts": {
"nfc_face_image": "https://dummy.image.url/nfc_face.jpg",
"ocr_face_image": "https://dummy.image.url/ocr_face.jpg",
"front_side_image": "https://dummy.image.url/front_side.jpg",
"active_liveness_image": "https://dummy.image.url/active_liveness.jpg"
},
"annotations": {
"face_matching": {
"mode": "both",
"notes": "",
"is_successful": true
}
},
"type": {
"value": 2,
"title": "International Passport"
},
"status": {
"value": 3,
"title": "Verified"
},
"status_notes": [],
"nfc_collected": true,
"processing_time": 4.745
},
"message": "Verification retrieved successfully.",
"consolidated_message": "Verification retrieved successfully.",
"details": {}
}
The status
field represents the current state of the verification.
"status": { "value": <integer>, "title": <string> }
Possible status
values:
value | title | Description |
1 | Data not collected | One or more verification steps based on the functionality configured, did not complete successfully within allowed attempts or retries. |
2 | Data collected | All of the functionality configured in the verification steps were completed successfully, but the final evaluation against the selected verification criteria is still pending. |
3 | Verified | All verification criteria (default or custom verification rules) were successfully met. These may include checks such as data collection, face match, or liveness —depending on setup. |
4 | Not verified | One or more verification criteria (from default or custom verification rules) were not met. These may include checks such as data collection, face match, or liveness —depending on setup. |
5 | Processing | Initial verification data has been successfully collected, and the backend is still processing the results |
Last updated on August 8, 2025