Last updated:
0 purchases
flutter nfc compatibility
Flutter NFC Compatibility Check #
Installation #
Add to pubspec.yaml:
dependencies:
flutter_nfc_compatibility: ^0.0.3
copied to clipboard
import 'package:flutter_nfc_compatibility/flutter_nfc_compatibility.dart';
copied to clipboard
How to use #
Android setup #
Add those two lines to your AndroidManifest.xml on the top
<uses-permission android:name="android.permission.NFC" />
<uses-feature
android:name="android.hardware.nfc"
android:required="true" />
copied to clipboard
Usage #
Handling Session
// Check availability
var nfcCompatibility = await FlutterNfcCompatibility.checkNFCAvailability();
// Different states of the NFC availibality
if(nfcCompatibility == NFCAvailability.Enabled ){
writerController.text = "Enabled";
}else if(nfcCompatibility == NFCAvailability.Disabled ){
writerController.text = "Disabled";
}else{
writerController.text = "Not Supported";
}
copied to clipboard
NFCAvailability can differentiate the states of the NFC
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.