flutter_nfc_compatibility 0.0.3 copy "flutter_nfc_compatibility: ^0.0.3" to clipboard
flutter_nfc_compatibility: ^0.0.3 copied to clipboard

PlatformAndroid
outdated

A nfc compatibility plugin for Android.

example/lib/main.dart

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

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Material App',
      home: Scaffold(
        appBar: AppBar(
          title: Text('Material App Bar'),
        ),
        body: Center(child: NfcScan()),
      ),
    );
  }
}

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

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

class _NfcScanState extends State<NfcScan> {
  TextEditingController writerController = TextEditingController();

  @override
  initState() {
    super.initState();

    writerController.text = 'Flutter NFC Check';
    checkAvailibility();
  }

  void checkAvailibility() async {
    var nfcCompatibility = await FlutterNfcCompatibility.checkNFCAvailability();
    if(nfcCompatibility ==NFCAvailability.Enabled ){
      writerController.text = "Enabled";
    }else if(nfcCompatibility == NFCAvailability.Disabled ){
      writerController.text = "Disabled";
    }else{
      writerController.text = "Not Supported";
    }
  }

  @override
  void dispose() {
    // Clean up the controller when the widget is removed from the
    // widget tree.
    writerController.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Column(
      children: <Widget>[
        TextField(
          controller: writerController,
        ),
      ],
    );
  }
}
3
likes
120
points
272
downloads

Publisher

verified publishermymax.uz

Weekly Downloads

A nfc compatibility plugin for Android.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on flutter_nfc_compatibility