nfc_check 1.0.1
nfc_check: ^1.0.1 copied to clipboard
A Flutter plugin to check for NFC and HCE support on Android devices, and open NFC settings.
nfc_check #
A Flutter plugin to check for NFC (Near Field Communication) and HCE (Host Card Emulation) support on Android devices. It also allows you to check if NFC is currently enabled and open the NFC settings page.
Features #
- Check NFC Support: Determine if the device has NFC hardware.
- Check NFC Enabled: Verify if NFC is currently enabled by the user.
- Check HCE Support: specific check for Host Card Emulation support.
- Open NFC Settings: Directly open the system NFC settings page.
Installation #
Add checking following dependency to your pubspec.yaml file:
dependencies:
nfc_check: ^1.0.0
Usage #
Import the package:
import 'package:nfc_check/nfc_check.dart';
Create an instance of NfcCheck:
final _nfcCheckPlugin = NfcCheck();
Check Capabilities #
// Check if NFC hardware is supported
bool isNfcSupported = await _nfcCheckPlugin.isNfcSupported();
// Check if NFC is currently enabled
bool isNfcEnabled = await _nfcCheckPlugin.isNfcEnabled();
// Check if HCE is supported
bool isHceSupported = await _nfcCheckPlugin.isHceSupported();
Open Settings #
try {
await _nfcCheckPlugin.openNfcSettings();
} catch (e) {
// Handle error (e.g., if NFC is not supported on the device)
print('Error opening NFC settings: $e');
}
Platform Support #
| Platform | NFC Support | HCE Support | Open Settings |
|---|---|---|---|
| Android | ✅ | ✅ | ✅ |
| iOS | ❌ | ❌ | ❌ |
License #
This project is licensed under the MIT License - see the LICENSE file for details.