sysmo_verification 0.0.8
sysmo_verification: ^0.0.8 copied to clipboard
A reusable KYC verification Flutter package
Sysmo Verification ๐ #
๐ Package Introduction #
Sysmo Verification is a comprehensive Flutter package designed to simplify multiple KYC (Know Your Customer) verification processes including Aadhaar, PAN, Voter ID, Passport, GST, and OTP workflows.
The package provides a unified approach to document verification with consistent UI/UX patterns, robust error handling, and flexible configuration options.
โจ Key Features #
- ๐จ Unified UI: Consistent interface across all verification types
- ๐ง Highly Customizable: Easily modify colors, styling, validation patterns, and API endpoints
- ๐ Reusable Components: Common UI widgets and base classes shared across all KYC modules
- โก Reactive Forms: Built on reactive_forms for better form management
- ๐ก๏ธ Robust Error Handling: Comprehensive error handling with specific exception types
- ๐ฑ Offline Support: Both online API and offline asset-based verification
- ๐ Type Safety: Full null safety support with improved type checking
- ๐งช Test Ready: Designed with testing in mind
๐ฏ Why Use This Package? #
- ๐ Saves Development Time โ No need to rebuild KYC flows repeatedly
- ๐จ Ensures Consistency โ All document types follow the same UI/UX pattern
- ๐๏ธ Modular & Maintainable โ Clear separation between UI, data models, and service layers
- ๐ก๏ธ Production Ready โ Comprehensive error handling and null safety
- ๐ Security First โ Built-in encryption, secure token management, and input validation
- ๐ฑ Cross-Platform โ Works on Android, iOS, Web, and Desktop
- ๐งช Well Tested โ High test coverage with unit, widget, and integration tests
- ๐ Comprehensive Documentation โ Detailed guides, examples, and API reference
- ๐ Flexible Architecture โ Supports both online API and offline verification modes
- โก Performance Optimized โ Efficient state management and network operations
๐ฆ Installation #
Add to pubspec.yaml #
dependencies:
sysmo_verification: ^0.0.8
# For local development:
# sysmo_verification:
# path: ../path_to_sysmo_verification
# For Git dependency:
# sysmo_verification:
# git:
# url: https://github.com/gayathribalraj/Sysmo_Verification.git
# ref: main
Then run:
flutter pub get
Platform-specific setup #
Android
Add to android/app/src/main/AndroidManifest.xml:
<uses-permission android:name="android.permission.INTERNET" />
iOS
Add to ios/Runner/Info.plist:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<false/>
</dict>
๐ Quick Start #
1. Import the package #
import 'package:sysmo_verification/kyc_validation.dart';
2. Basic Usage Example #
class MyVerificationScreen extends StatelessWidget {
final FormGroup form = FormGroup({
'pan': FormControl<String>(
validators: [Validators.required],
),
});
@override
AadhaarVerification(
kycTextBox: KYCTextBox(
fieldKey: GlobalKey(),
validationPattern:
AppConstants.AADHAAR_PATTERN,
validationPatternErrorMessage:
'Please enter a valid AadhaarNumber (e.g. 123456789012)',
formProps: FormProps(
formControlName: 'idProofValue',
label: 'ID proof Value',
mandatory: true,
maxLength: 12,
),
styleProps: StyleProps(),
apiUrl: '',
buttonProps: ButtonProps(
label: 'verify',
foregroundColor: Colors.white,
),
isOffline: true,
onSuccess: (value) async {
print('onSuccess ${value.data}');
},
onError: (value) {
print(" onerror $value");
},
verificationType: VerificationType.aadhaar,
otpGendraassetApiurl: '',
otpGendrateassetPath:
AppConstants.otpGendrateResponse,
aadhaarResponseApiurl: '',
aadhaarResponseassetspath:
AppConstants.aadhaarResponse,
aadharvaultassetpath:
AppConstants.aadharvault,
aadharvaultApiurl: '',
aadharvaultlookupassetpath:
AppConstants.aadharvaultlookup,
aadharvaultlookupapiurl: '',
leadId: leadId,
token: '',
),
),
ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: Color.fromARGB(255, 3, 9, 110),
foregroundColor: Colors.white,
padding: EdgeInsets.symmetric(
horizontal: 24,
vertical: 12,
),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
),
),
onPressed: () {
print("Form values: ${Form.value}");
if (Form.valid) {
print(
"Form is valid",
);
}
}
)
}
๐ Supported Verification Types #
| Type | Document | Verification Method | Special Features |
|---|---|---|---|
| ๐ Aadhaar | Aadhaar Number | OTP-based | Shows OTP verification sheet |
| ๐ณ PAN | PAN Number | Instant verify | Single request โ instant result |
| ๐ณ๏ธ Voter ID | Voter Number | Instant verify | Single request โ instant result |
| ๐ข GST | GST Number | Instant verify | Single request โ instant result |
| โ๏ธ Passport | Passport Number | Instant verify | Single request โ instant result |
๐ง Configuration Options #
FormProps - Input Field Configuration #
FormProps(
formControlName: 'document_number', // Name of the form control
label: 'Document Number', // Input field label
hint: 'Enter your document number', // Placeholder text
mandatory: true, // Whether the field is required
maxLength: 10, // Maximum character limit
validator: (control) => /* custom validation */,
)
ButtonProps - Button Behavior & Appearance #
ButtonProps(
label: 'Verify Document', // Button text
backgroundColor: Colors.blue, // Background color
foregroundColor: Colors.white, // Text/icon color
borderRadius: 8.0, // Corner radius
padding: EdgeInsets.all(16), // Inner padding
disabled: false, // Whether button is disabled
)
StyleProps - Visual Styling #
StyleProps(
borderRadius: 8.0, // Input field corner radius
textStyle: TextStyle(fontSize: 16), // Text styling
padding: EdgeInsets.all(16), // Widget padding
backgroundColor: Colors.grey[50], // Background color
borderColor: Colors.grey, // Border color
inputDecoration: InputDecoration(/* custom */), // Custom input decoration
)
๐ Advanced Usage #
Error Handling with Result Pattern #
// Using the safe verification method
final result = await KYCService().verifySafe(
isOffline: false,
url: 'https://api.example.com/verify',
request: jsonEncode({'pan': panNumber}),
);
result.fold(
(exception) {
// Handle different error types
if (exception is NetworkException) {
print('Network error: ${exception.message}');
} else if (exception is ValidationException) {
print('Validation error: ${exception.message}');
print('Field: ${exception.field}');
} else if (exception is AuthException) {
print('Authentication error: ${exception.message}');
}
},
(response) {
print('Success: ${response.data}');
},
);
Custom Validation Patterns #
// PAN validation
final panPattern = RegExp(r'^[A-Z]{5}[0-9]{4}[A-Z]{1}$');
// Aadhaar validation
final aadhaarPattern = RegExp(r'^\d{4}\s?\d{4}\s?\d{4}$');
// GST validation
final gstPattern = RegExp(r'^\d{2}[A-Z]{5}\d{4}[A-Z]{1}[A-Z\d]{1}[Z]{1}[A-Z\d]{1}$');
Offline Verification Setup #
For offline verification, prepare JSON files in your assets:
# pubspec.yaml
flutter:
assets:
- assets/mock_data/
Example mock data structure:
{
"Success": true,
"PanValidation": {
"success": true,
"name": "John Doe",
"panNumber": "ABCDE1234F"
}
}
๐จ UI Components #
KYCTextBox #
The main widget that combines input field and verification button:
KYCTextBox(
verificationType: VerificationType.pan,
validationPattern: RegExp(r'^[A-Z]{5}[0-9]{4}[A-Z]{1}$'),
// ... other properties
)
Standalone Components #
// Input field only
KYCInputField(
formProps: FormProps(/* ... */),
styleProps: StyleProps(/* ... */),
validationManager: InputValidationManager(),
)
// Button only
VerifyButton(
buttonProps: ButtonProps(/* ... */),
onPressed: () { /* handle verification */ },
)
๐งช Testing #
The package is designed with testing in mind:
// Example test
testWidgets('Aadhaar verification widget test', (WidgetTester tester) async {
final formGroup = FormGroup({'aadhar': FormControl<String>()});
await tester.pumpWidget(
MaterialApp(
home: ReactiveForm(
formGroup: formGroup,
child: KYCTextBox(
verificationType: VerificationType.pan,
// ... other props
),
),
),
);
// Test widget behavior
expect(find.text('Aadhaar Number'), findsOneWidget);
// ... more tests
});
๐ Debugging #
Enable detailed logging:
// In your main.dart or initialization code
ApiClient client = ApiClient(enableLogging: true);
๐ API Reference #
Core Classes #
KYCTextBox- Main verification widgetKYCService- Service for handling verification requestsVerificationHandler- Abstract handler for different verification typesResponseParser- Parse API responsesButtonStateManager- Manage button statesInputValidationManager- Handle input validation
Error Types #
KycException- Base exception classNetworkException- Network-related errorsValidationException- Input validation errorsAuthException- Authentication errorsConfigurationException- Configuration errorsOtpException- OTP-specific errors
๐ Documentation #
Getting Started #
- ๐ Quick Start Guide - Get up and running in minutes
- ๐ฆ Installation Guide - Platform-specific setup instructions
- ๐ฏ Supported Verification Types - Available document types
Comprehensive Guides #
- ๐ API Reference - Complete API documentation with examples
- ๐ง Configuration Guide - Detailed configuration options
- ๐ Examples - Practical usage examples and code samples
- ๐งช Testing Guide - Unit, widget, and integration testing
- ๐ Migration Guide - Version migration instructions
Advanced Topics #
- ๐ Security Guide - Security best practices and compliance
- ๐ค Contributing - How to contribute to this project
- ๐ Changelog - Version history and release notes
Resources #
- ๐ก Usage Examples - Common implementation patterns
- ๐จ Custom Styling - UI customization options
- ๐ ๏ธ Error Handling - Robust error management strategies
๐ค Contributing #
We welcome contributions! Please read our Contributing Guide for details on:
- Code of conduct
- Development setup
- Pull request process
- Code style guidelines
๐ License #
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Support #
For issues and questions:
- ๐ Report bugs
- ๐ฌ Discussions
- ๐ง Email: support@sysmo.com
- ๐ Security issues: security@sysmo.com
๐ฏ Roadmap #
Upcoming Features #
- โ Biometric Verification - Fingerprint and face recognition support
- โ Additional Document Types - Driving License, Passport enhancements
- โ Enhanced Offline Mode - Improved offline capabilities and caching
- โ Multi-language Support - Localization for multiple languages
- โ Advanced Analytics - Verification metrics and reporting
Performance & Quality #
- โ Performance Optimizations - Faster verification processing
- โ Enhanced Testing - Improved test coverage and automation
- โ Better Error Handling - More specific error types and messages
- โ Accessibility Improvements - Better screen reader and keyboard support
Developer Experience #
- โ Flutter DevTools Integration - Enhanced debugging capabilities
- โ Code Generation - Auto-generate configuration classes
- โ Documentation Enhancements - Interactive examples and tutorials
- โ CLI Tools - Command-line utilities for common tasks
๐ Contributors #
Thanks to all contributors who help make this package better:
๐ Statistics #
*Made with โค๏ธ for the Mobile Development Team