flutter中的nfc库推荐以及demo

李凯定
2023-12-01

flutter_nfc_reader(https://pub.dev/packages/flutter_nfc_reader

需要配置安卓、ios(具体看文档即可)

 


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

class NfcTestPages extends StatefulWidget {
  NfcTestPages({Key key}) : super(key: key);

  @override
  _NfcTestPagesState createState() => _NfcTestPagesState();
}

class _NfcTestPagesState extends State<NfcTestPages> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("NFC功能"),
      ),
      body: Container(
        child: Column(
          children: <Widget>[
            Container(
              color: Colors.red,
              padding: EdgeInsets.all(20),
              child: GestureDetector(child: Text('开始读卡'), onTap: () => {reader()}),//点击)
       
 类似资料: