搜索插件、代码仓与 APP 分类

alt_sms_autofill 封面
插件详情v1.0.0

alt_sms_autofill

替代短信自动填充

AndroidiOS
近 30 天下载
215
喜欢数
57
Pub 分数
130

安装插件

flutter pub add alt_sms_autofill

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

Alt Sms Autofill 是一个 Flutter 包,旨在自动检测并填充 PIN、OTP 和密码输入字段中的短信验证码(一次性密码)。它可在 Android 和 iOS 平台上运行,通过从收到的短信中获取验证代码,为用户提供无缝的使用体验。该包支持自定义短信消息模式,并提供回调函数以处理检测到的验证码。非常适合需要通过短信验证实现安全快速认证的应用。

适合场景

  • 从短信自动填充验证码
  • 通过短信验证简化用户登录
  • 减少PIN字段中的手动输入错误
  • 支持多平台OTP输入
  • 提高表单填写速度

主要特点

  • 从短信中检测并自动填充一次性密码
  • 可自定义的短信模式匹配
  • 跨平台支持(Android 和 iOS)
  • 与文本字段的简单集成
  • 用于处理检测到的代码的回调

适合对象

  • 使用短信验证的身份验证流程
  • 需要快速输入OTP的应用
  • 开发安全登录系统的开发者
  • 面向全球用户的移动应用
  • 需要最少设置即可实现OTP自动填充的项目

使用建议

  • 需要 Android 的短信权限
  • 如果短信格式不符合预期模式,可能无法正常工作
  • 仅限具有短信访问权限的设备
  • iOS 需要额外配置才能实现完整功能
  • 取决于设备级别的短信处理功能

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

alt_sms_autofill

Alt Sms Autofill.

Getting Started

This project is for getting new arrived sms and shows on application. Sms completely return into application and you can split it as you want.

Usage

Add it to your pubspec.yaml file:


dependencies:

alt_sms_autofill: version

In your library add the following import:


import 'package:alt_sms_autofill/alt_sms_autofill.dart';

Here is an example how to use:

class _MyAppState extends State<MyApp> {
  String _commingSms = 'Unknown'; 

  Future<void> initSmsListener() async {

    String commingSms;
    try {
      commingSms = await AltSmsAutofill().listenForSms;
    } on PlatformException {
      commingSms = 'Failed to get Sms.';
    }
    if (!mounted) return;

    setState(() {
      _commingSms = commingSms;
    });

  }

  @override
  void dispose() {

    AltSmsAutofill().unregisterListener();
    super.dispose();

  }

  @override
  Widget build(BuildContext context) {

    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('AltAutoFill example app'),
        ),
        body: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Center(
              child: Text('Running on: $_commingSms\n'),
            ),
            TextButton(
              child: Text('Listen for sms code'),
              onPressed: initSmsListener,
            ),
          ],
        ),
      ),
    );

  }

parameters

  • listenForCode() to listen for the SMS code from the native plugin when SMS is received.
  • unregisterListener() to unregister the broadcast receiver, need to be called on your dispose.

#ff packages pub publish

所属分类

源码仓库

使用此插件的项目

暂无相关数据。