otpless_flutter_web 1.1.7 copy "otpless_flutter_web: ^1.1.7" to clipboard
otpless_flutter_web: ^1.1.7 copied to clipboard

A versatile Flutter web package eliminating the need for OTP during user authentication. Simplify secure login workflows effortlessly.

example/lib/main.dart

import 'dart:async';
import 'dart:developer';

import 'package:flutter/material.dart';
import 'package:otpless_flutter_web/otpless_flutter_web.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Otpless Flutter Web Testing',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const HomeScreen(),
    );
  }
}

class HomeScreen extends StatefulWidget {
  const HomeScreen({super.key});

  @override
  State<HomeScreen> createState() => _HomeScreenState();
}

class _HomeScreenState extends State<HomeScreen> {
  String? name;
  String? number;

  //Define the instance
  final _otplessFlutterPlugin = Otpless();
  final completer = Completer<String>();
  //************************************************************************* */
  //This function will run the floater in the app which contains the WhatsApp button for Authentication
  //************************************************************************* */

  void startHeadless(String channelType) async {
    await _otplessFlutterPlugin.startHeadless(channelType).then((value) {
      log(value);
      setState(() {});
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(),
      floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
      floatingActionButton: FloatingActionButton(
        onPressed: () {
          startHeadless("WHATSAPP");
        },
        child: const Text(
          "Login",
        ),
      ),
      body: Center(
        child: Column(
          children: [
            Text(
              "Name : $name",
              style: const TextStyle(
                fontSize: 25,
              ),
            ),
            const SizedBox(height: 10),
            Text(
              "Number : $number",
              style: const TextStyle(
                fontSize: 25,
              ),
            ),
          ],
        ),
      ),
    );
  }
}
3
likes
0
points
64
downloads

Publisher

unverified uploader

Weekly Downloads

A versatile Flutter web package eliminating the need for OTP during user authentication. Simplify secure login workflows effortlessly.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on otpless_flutter_web