π§© Avlc SDK
avlcweb is a Flutter SDK that helps developers integrate authentication and OTP verification features into their apps using email or phone. It includes methods for logging in users, sending OTPs, verifying OTPs, and managing access/refresh tokens via SharedPreferences.
π Features
- User Login with Email & Password
- Send OTP to Email or Phone
- Verify OTP
- Access Token & Refresh Token Storage
- Callback-based Initialization
π¦ Installation
Add the following to your pubspec.yaml:
dependencies:
avlcweb: ^1.0.0
π οΈ Usage
1. Import the SDK
import 'package:avlcweb/avlcweb.dart';
2. Initialize the SDK
final avlc = AvlcWeb(
email: "user@example.com",
password: "yourpassword",
onInitialize: (isInitialized, {error}) {
if (isInitialized) {
print("SDK Initialized and User Logged In!");
} else {
print("Initialization failed: $error");
}
},
);
3. Send OTP
avlc.sendOtp({"email": "user@example.com"}, (response) {
print("OTP Send Response: $response");
});
4. Verify OTP
avlc.verifyOtp({"email": "user@example.com", "otp": "123456"}, (response) {
print("OTP Verify Response: $response");
});
π§ͺ Example
final avlcweb = AvlcWeb();
avlcweb.initialize(
email: "john.doe@gmail.com",
password: "securePassword123",
onInitialize: (isInitialized, {error}) {
if (isInitialized) {
print("Welcome!");
} else {
print("Login error: $error");
}
},
);
π API Reference
| Method | Description |
|---|---|
sendOtp() |
Sends OTP to email or phone number |
verifyOtp() |
Verifies the OTP sent to email or phone number |
getPlatformVersion() |
Returns the platform version (optional) |
π License
MIT License. See the LICENSE file for more details.