v1.0.0alt_sms_autofill
替代短信自动填充
57喜欢 215近 30 天下载130Pub 分数
AndroidiOS
tazik561/alt_sms_auto_fill open-source repository details.
以下为英文项目原文快照,最新内容请访问 GitHub。
Alt Sms Autofill.
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.
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,
),
],
),
),
);
}
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
依赖清单 2 项
{"sdk":"flutter"}{"sdk":"flutter"}先按使用场景筛选,再比较项目活跃情况,最后到原始仓库核对使用要求。
“A repository is the most basic element of GitHub.”
GitHub Docs — About repositories ↗