smssak 1.0.2 copy "smssak: ^1.0.2" to clipboard
smssak: ^1.0.2 copied to clipboard

A Dart package for sending and verifying OTPs (One-Time Passwords) via SMS. Easily integrate OTP functionality into your Flutter apps.

OTP Service #

A Dart package for sending and verifying OTPs (One-Time Passwords) using an external API. This package is designed to be simple and easy to integrate into Flutter apps.

Features #

  • Send OTP to a phone number.
  • Verify OTP for a given phone number.

Installation #

Add the following to your pubspec.yaml file:

dependencies:
  smssak: ^1.0.0

Then, run flutter pub get to install the package.

Usage #

Sending an OTP #

To send an OTP, use the sendOtp method:

import 'package:smssak/smssak.dart';

void main() async {
  final otpService = OTPService();

  final response = await otpService.sendOtp(
    country: 'dz', // 2-letter country code
    projectId: 'your_project_id', // Your project ID
    phone: '1234567890', // Phone number to send OTP to
    key: 'your_api_key', // Your API key
  );

  print('OTP Sent: $response');
}

Verifying an OTP #

To verify an OTP, use the verifyOtp method:

import 'package:smssak/smssak.dart';

void main() async {
  final otpService = OTPService();

  final response = await otpService.verifyOtp(
    country: 'dz', // 2-letter country code
    projectId: 'your_project_id', // Your project ID
    phone: '1234567890', // Phone number to verify
    otp: '123456', // OTP to verify
    key: 'your_api_key', // Your API key
  );

  print('OTP Verified: $response');
}
0
likes
150
points
37
downloads

Publisher

unverified uploader

Weekly Downloads

A Dart package for sending and verifying OTPs (One-Time Passwords) via SMS. Easily integrate OTP functionality into your Flutter apps.

Documentation

API reference

License

MIT (license)

Dependencies

http

More

Packages that depend on smssak