All Projects → matteocrippa → Flutter Nfc Reader

matteocrippa / Flutter Nfc Reader

Licence: mit
Flutter NFC reader plugin for iOS and Android

Programming Languages

kotlin
9241 projects

Projects that are alternatives of or similar to Flutter Nfc Reader

flutter-nfc
Flutter Android plugin for NFC
Stars: ✭ 14 (-94.17%)
Mutual labels:  nfc, flutter-plugin
flutter nfc kit
Flutter plugin to provide NFC functionality on Android and iOS, including reading metadata, read & write NDEF records, and transceive layer 3 & 4 data with NFC tags / cards
Stars: ✭ 119 (-50.42%)
Mutual labels:  nfc, flutter-plugin
Flutter Credit Card Input Form
Flutter Credit Card Input form
Stars: ✭ 201 (-16.25%)
Mutual labels:  flutter-plugin
Wwdc
You don't have the time to watch all the WWDC session videos yourself? No problem me and many contributors extracted the gist for you 🥳
Stars: ✭ 2,561 (+967.08%)
Mutual labels:  nfc
Chameleonmini Rebooted
Chameleon Mini revE rebooted - Iceman Fork, the ChameleonMini is a versatile contactless smartcard emulator (NFC/RFID)
Stars: ✭ 208 (-13.33%)
Mutual labels:  nfc
Mifareclassictool
An Android NFC app for reading, writing, analyzing, etc. MIFARE Classic RFID tags.
Stars: ✭ 2,698 (+1024.17%)
Mutual labels:  nfc
App review
App Review - Request and Write Reviews and Open Store Listing for Android and iOS in Flutter. Maintainer: @rodydavis
Stars: ✭ 213 (-11.25%)
Mutual labels:  flutter-plugin
Android Studio Plugins
This is a list of all awesome and useful android studio plugins.
Stars: ✭ 2,186 (+810.83%)
Mutual labels:  flutter-plugin
Sqfentity
SqfEntity ORM for Flutter/Dart lets you build and execute SQL commands on SQLite database easily and quickly with the help of fluent methods similar to .Net Entity Framework. SqfEntity also generates add/edit forms with validations and special controls (DropDown List, DateTime pickers, Checkboxes.. etc) for your table.
Stars: ✭ 237 (-1.25%)
Mutual labels:  flutter-plugin
Flutter speed dial
Flutter plugin to implement a Material Design Speed Dial
Stars: ✭ 206 (-14.17%)
Mutual labels:  flutter-plugin
Betterplayer
Better video player for Flutter, with multiple configuration options. Solving typical use cases!
Stars: ✭ 205 (-14.58%)
Mutual labels:  flutter-plugin
Awesome Fluttercn
一份 Flutter 优秀中文资源列表,在这里能找到优质的Flutter库、工具,教程,文章等。
Stars: ✭ 208 (-13.33%)
Mutual labels:  flutter-plugin
Geolocation
Flutter geolocation plugin for Android and iOS.
Stars: ✭ 205 (-14.58%)
Mutual labels:  flutter-plugin
Flutter plugin record
flutter 仿微信录制语音功能 支持android和ios
Stars: ✭ 214 (-10.83%)
Mutual labels:  flutter-plugin
Flutter statusbarcolor
A package can help you to change your flutter app's statusbar's color or navigationbar's color programmatically.
Stars: ✭ 203 (-15.42%)
Mutual labels:  flutter-plugin
Flutter fluid slider
A fluid design slider that works just like the Slider material widget.
Stars: ✭ 232 (-3.33%)
Mutual labels:  flutter-plugin
Flutter crashlytics
📦 Flutter plugin for Crashlytics integration
Stars: ✭ 193 (-19.58%)
Mutual labels:  flutter-plugin
Flutterexampleapps
[Example APPS] Basic Flutter apps, for flutter devs.
Stars: ✭ 15,950 (+6545.83%)
Mutual labels:  flutter-plugin
Scratcher
Scratch card widget which temporarily hides content from user.
Stars: ✭ 210 (-12.5%)
Mutual labels:  flutter-plugin
Metrodroid
Read data from public transit cards using your NFC Android phone! (iOS 13 and PC/SC support coming soon)
Stars: ✭ 238 (-0.83%)
Mutual labels:  nfc

Flutter NFC Reader & Writer

A new flutter plugin to help developers looking to use internal hardware inside iOS or Android devices for reading and writing NFC tags.

The system activate a pooling reading session that stops automatically once a tag has been recognised. You can also trigger the stop event manually using a dedicated function.

Supported NFC Format

Platform Supported NFC Tags
Android NDEF: A, B, F, V, BARCODE
iOS NDEF: NFC TYPE 1, 2, 3, 4, 5

Only Android supports nfc tag writing

Installation

Add to pubspec.yaml:

dependencies:
  flutter_nfc_reader: ^0.1.0

or to get the experimental one:

dependencies:
  flutter_nfc_reader:
    git:
      url: git://github.com/matteocrippa/flutter-nfc-reader.git
      ref: develop

and then run the shell

flutter packages get

last step import to the project:

import 'package:flutter_nfc_reader/flutter_nfc_reader.dart';

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" />

Assign 19 in minSdkVersion in the build.gradle (Module: app)

defaultConfig {
...
minSdkVersion 19
...
}

iOS Setup

Atm only Swift based Flutter project are supported.

  • Enable Capabilities / Near Field Communication Tag Reading.
  • Info.plist file, add Privacy - NFC Scan Usage Description with string value NFC Tag.

In your Podfile add this code in the top

platform :ios, '8.0'
use_frameworks!

Read NFC

This function will return a promise when a read occurs, till that very moment the reading session is open. The promise will return a NfcData model, this model contains:

FlutterNfcReader.read() and FlutterNfcReader.onTagDiscovered() have an optional parameter, only for iOS, called instruction. You can pass a String that contains information to be shown in the modal screen.

  • id > id of the tag
  • content > content of the tag
  • error > if any error occurs
FlutterNfcReader.read().then((response) {
    print(response.content);
});

Stream NFC

this function will return a Stream that emits NfcData everytime a tag is recognized. On Ios you can use this too but IOS will always show a bottom sheet when it wants to scan a NFC Tag. Therefore you need to explicitly cast FlutterNfcReader.read() when you expect a second value. When subscribing to the stream the read function is called a first time for you. View the Example for a sample implementation.

FlutterNfcReader.onTagDiscovered().listen((onData) {
  print(onData.id);
  print(onData.content);
});

Write NFC (Only Android)

This function will return a promise when a write occurs, till that very moment the reading session is open. The promise will return a NfcData model, this model contains:

  • content > writed in the tag
FlutterNfcReader.write("path_prefix","tag content").then((response) {
print(response.content);
});

Read & Write NFC (Only Android)

You can read and then write in an nfc tag using the above functions as follows

FlutterNfcReader.read().then((readResponse) {
    FlutterNfcReader.write(" ",readResponse.content).then((writeResponse) {
        print('writed: ${writeResponse.content}');
    });
});

Stop NFC

  • status > status of ncf reading or writing stoped
FlutterNfcReader.stop().then((response) {
    print(response.status.toString());
});

For better details look at the demo app.

Check NFC Availability

In order to check whether the Device supports NFC or not you can call FlutterNfcReader.checkNFCAvailability(). The method returns NFCAvailability.available when NFC is supported and enabled, NFCAvailability.disabled when NFC is disabled (Android only) and NFCAvailability.not_supported when the user's hardware does not support NFC.

IOS Specifics

IOS behaves a bit different in terms of NFC Scanning and writing.

  • Ids of the tags aren't possible in the current implementation
  • each scan is visible for the user with a bottom sheet

Getting Started

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

For help on editing plugin code, view the documentation.

Contributing

Please take a quick look at the contribution guidelines first. If you see a package or project here that is no longer maintained or is not a good fit, please submit a pull request to improve this file. Thank you to all contributors!!

to develop on ios you need to activate the "legacy" build system because of this issue in flutter:

https://github.com/flutter/flutter/issues/20685

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].