sysmo_verification 0.0.7 copy "sysmo_verification: ^0.0.7" to clipboard
sysmo_verification: ^0.0.7 copied to clipboard

A reusable KYC verification Flutter package

Sysmo Verification ๐Ÿ” #

Version Flutter License

๐Ÿ“‹ 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.7

  # 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 widget
  • KYCService - Service for handling verification requests
  • VerificationHandler - Abstract handler for different verification types
  • ResponseParser - Parse API responses
  • ButtonStateManager - Manage button states
  • InputValidationManager - Handle input validation

Error Types #

  • KycException - Base exception class
  • NetworkException - Network-related errors
  • ValidationException - Input validation errors
  • AuthException - Authentication errors
  • ConfigurationException - Configuration errors
  • OtpException - OTP-specific errors

๐Ÿ“š Documentation #

Getting Started #

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 #

๐Ÿค 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:

๐ŸŽฏ 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 #

  • Downloads: Pub Downloads
  • Issues: GitHub issues
  • Stars: GitHub stars

*Made with โค๏ธ for the Mobile Development Team

2
likes
0
points
425
downloads

Publisher

unverified uploader

Weekly Downloads

A reusable KYC verification Flutter package

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

dio, encrypt, equatable, flutter, flutter_bloc, flutter_dotenv, flutter_otp_text_field, pretty_dio_logger, reactive_forms

More

Packages that depend on sysmo_verification