VOOZH about

URL: https://www.geeksforgeeks.org/flutter/how-to-create-a-nfc-reader-and-writer-flutter-application/

⇱ How to Create a NFC Reader and Writer Flutter Application - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

How to Create a NFC Reader and Writer Flutter Application

Last Updated : 23 Jul, 2025

NFC that stands for Near Field Communication, is a very short range wireless technology that allows us share small amount of data between devices. Through this technology we can share data between an NFC tag and an android device or between two android devices. A maximum of 4 cm distance is required to establish this connection. In this articles, we will be developing a basic application that involved communicating between an Android Device and a NFC Tag.

Prerequisites

  1. NFC-Enabled Android Device - Your device must support NFC.
  2. Android Studioor Visual Studio Code- Install Android Studio or Visual Studio Code in your System.
  3. Basic Knowledge of Flutter & dart - We will be developing this app using the Flutter & Dart.
  4. NFC Tag - You must have a NFC tag, sticker or a card for testing purposes.

Steps to Create a NFC Reader and Writer Android Application

Step 1: Create a New Project in Android Studio or Visual Studio Code.

To create a new project in Android Studio please refer to Creating a Simple Application in Flutter.

Step 2: In your flutter project open pubspec.yaml and under dependencies add the following packages:

dependencies:
flutter:
sdk: flutter
nfc_manager: ^3.5.0

To know more about package refer : nfc_manager

Step 3: Adding Permissions in Manifest File

Navigate to android > app > src > main > AndroidManifest.xml and add the following permissions under the manifest tag.

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


Step 3: Working with main.dart

main.dart include 3 primary functionalities to execute NFC in flutter application.

  • Check the device is compatible with NFC or Not
  • Read data using NFC
  • Write data using NFC

-


-


-


The whole Application code for this is provided below:

main.dart:


Output:

Note : default NFC reader can pop-up in your screen. So, the solution is preventing default Android NFC reader.

Solution of the above Problem

If you get any uneven behavior of the app like opening a default pop-up in the middle of the process then to control that behavior add below code in android > app > src > main > kotlin > com > example > oyo > MainActivity.kt.

MainActivity.kt:


For GitHub link for the repository for the application is refer to this link.


Comment
Article Tags:

Explore