mifare_nfc_classic 0.1.0 copy "mifare_nfc_classic: ^0.1.0" to clipboard
mifare_nfc_classic: ^0.1.0 copied to clipboard

discontinued
outdated

A new Flutter plugin.

mifare_nfc_classic #

A Flutter plugin for Android for reading and writing NFC cards

Notice #

  • Only Mifare Classic
  • Only NfcA technology
  • Only works with default password

Setup #

Notes #

  • Remember that you shouln't write in the sector 0 of any card
  • If you write in the 4th block of any sector write down what you write this is the new password for write and read in this sector

Usage #

Check NFC Availability

// Check availability
AVAILABILITY isAvailable = await MifareNfcClassic.availability;
switch(isAvailable){
    case(AVAILABILITY.AVAILABLE):
        //NFC is enabled.
        break;
    case(AVAILABILITY.NOT_ENABLED):
        //The phone support NFC but user has to enable it.
        break;
    case(AVAILABILITY.NOT_SUPPORTED):
        //The phone doesn't support NFC.
        break;
}

Get Sector or Block Count

int _sectorCount = await MifareNfcClassic.sectorCount;
int _blockCount = await MifareNfcClassic.blockCount;

Read a specific Sector

List<String> _sector = await MifareNfcClassic.readSector(sectorIndex:index)
/*
["FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF",
"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF",
"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF",
"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"]
*/

Read a specific Block of a specific Sector

String _block = await MifareNfcClassic.readBlockOfSector(blockIndex: _blockIndex,sectorIndex: _sectorIndex);
/*
"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
*/

Read all sectors of a card

Note: This operation take some seconds so leave the card close to the phone like for 3 seconds.

List<List<String>> _card = await MifareNfcClassic.readAll;
/*
[["FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF",
"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF",
"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF",
"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"],
...
...
...
["FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF",
"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF",
"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF",
"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"]]
*/

Write a specific Block of a specific Sector

bool didWrite = await  MifareNfcClassic.writeBlockOfSector(blockIndex: _blockIndex,sectorIndex: _sectorIndex,message: _message);
/*
didWrite indicates if the operation completed successfully or not.
*/
5
likes
0
pub points
24%
popularity

Publisher

unverified uploader

A new Flutter plugin.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter, logger

More

Packages that depend on mifare_nfc_classic