flutter_nfc_reader 0.0.2 copy "flutter_nfc_reader: ^0.0.2" to clipboard
flutter_nfc_reader: ^0.0.2 copied to clipboard

outdated

A nfc reader plugin for iOS and Android.

flutter_nfc_reader #

A new flutter plugin project.

How to use #

Android setup #

Add those two lines to your AndroidManifest.xml

<uses-permission android:name="android.permission.NFC" />
<uses-feature
        android:name="android.hardware.nfc"
        android:required="true" />

Read NFC #

This function will return a promise when a read occurs, till that very moment the reading session is open. In order to stop a reading session you need to use stop function.

 Future<Null> NfcRead() async {
    String response;
    try {
      final String result = await FlutterNfcReader.read;
      if (result != null) {
        response = '';
      } else {
        response = result;
      }
    } on PlatformException {
      response = '';
    }
    setState(() {
      _nfcActive = true;
      _nfcData = response;
    });
  }

Stop NFC #


  Future<Null> NfcStop() async {
    bool response;
    try {
      final bool result = await FlutterNfcReader.stop;
      response = !result;
    } on PlatformException {
      response = false;
    }
    setState(() {
      _nfcActive = response;
    });
  }

For better details look at the demo app.

Getting Started #

For help getting started with Flutter, view our online documentation.

For help on editing plugin code, view the documentation.

45
likes
0
pub points
85%
popularity

Publisher

unverified uploader

A nfc reader plugin for iOS and Android.

Homepage

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on flutter_nfc_reader