otp_phone_verify 1.0.4
otp_phone_verify: ^1.0.4 copied to clipboard
A beautiful and customizable Flutter package for phone number verification using WhatsApp OTP via WhatsOTP.me service. Features multi-language support, beautiful themes, and easy integration.
OTP Phone Verify #
A beautiful and customizable Flutter package for phone number verification using WhatsApp OTP via WhatsOTP.me service.
Screenshots #
API Documentation #
Full API Documentation: WhatsOTP.me API Docs
Features #
- Send OTP via WhatsApp to any phone number
- Verify OTP codes with local verification (fast & secure)
- Resend OTP functionality with countdown timer
- Check account balance
- Multiple theme presets (Default, Dark, Blue, Green, Purple)
- Multi-language support (English, Arabic, French, Spanish)
- RTL support for Arabic
- Easy integration with just a few lines of code
Installation #
Add this to your pubspec.yaml:
dependencies:
otp_phone_verify: ^1.0.3
Or from GitHub:
dependencies:
otp_phone_verify:
git:
url: https://github.com/Ouknik/otp_phone_verify.git
ref: main
Then run:
flutter pub get
Getting API Credentials #
- Sign up at WhatsOTP.me
- Go to your dashboard and get your API credentials
- View full API documentation: API Docs
Quick Start #
Basic Usage with Dialog #
The easiest way to implement phone verification:
import 'package:otp_phone_verify/otp_phone_verify.dart';
// Configure your credentials
final config = OtpConfig(
apiKey: 'YOUR_API_KEY',
apiSecret: 'YOUR_API_SECRET',
);
// Show verification dialog
final result = await OtpPhoneVerifyDialog.show(
context: context,
config: config,
phoneNumber: '+1234567890',
);
if (result != null && result.verified) {
print('Phone verified successfully!');
print('Phone: ${result.phoneNumber}');
}
With Custom Theme #
final result = await OtpPhoneVerifyDialog.show(
context: context,
config: config,
phoneNumber: '+1234567890',
theme: OtpDialogTheme.dark(), // or .blue(), .green(), .purple()
);
With Arabic Language (RTL) #
final result = await OtpPhoneVerifyDialog.show(
context: context,
config: config,
phoneNumber: '+1234567890',
translations: OtpTranslations.arabic(),
isRtl: true,
);
Available Themes #
| Theme | Description |
|---|---|
OtpDialogTheme() |
Default light theme |
OtpDialogTheme.dark() |
Dark mode theme |
OtpDialogTheme.blue() |
Blue accent theme |
OtpDialogTheme.green() |
Green accent theme |
OtpDialogTheme.purple() |
Purple accent theme |
Available Languages #
| Language | Usage |
|---|---|
| English | OtpTranslations() |
| Arabic | OtpTranslations.arabic() |
| French | OtpTranslations.french() |
| Spanish | OtpTranslations.spanish() |
API Reference #
OtpConfig #
| Parameter | Type | Description |
|---|---|---|
apiKey |
String | Your WhatsOTP.me API key |
apiSecret |
String | Your WhatsOTP.me API secret |
OtpPhoneVerifyDialog.show() #
| Parameter | Type | Description |
|---|---|---|
context |
BuildContext | Required - Build context |
config |
OtpConfig | Required - API configuration |
phoneNumber |
String | Required - Phone number to verify |
theme |
OtpDialogTheme | Optional - Dialog theme |
translations |
OtpTranslations | Optional - Text translations |
isRtl |
bool | Optional - RTL layout support |
Security #
- OTP codes are verified locally after being received from the server
- API credentials are sent via secure headers
- All communication uses HTTPS
Example App #
Check out the example directory for a complete working example.
Contributing #
Contributions are welcome! Please feel free to submit a Pull Request.
License #
This project is licensed under the MIT License - see the LICENSE file for details.
Links #
- WhatsOTP.me - The OTP service provider
- API Documentation - Complete API docs
- GitHub Repository - Source code
- pub.flutter-io.cn - Package page
Support #
For questions or support, please visit WhatsOTP.me or open an issue on GitHub.
