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

discontinued
outdated

A new Flutter plugin.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:mifare_nfc_classic/mifare_nfc_classic.dart';

import 'package:mifare_nfc_classic_example/example_page.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  final isAvailable = MifareNfcClassic.availability;
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: FutureBuilder(
        future: isAvailable,
        builder: (_, snapshot) {
          if (snapshot.connectionState == ConnectionState.done) {
            switch (snapshot.data) {
              case AVAILABILITY.AVAILABLE:
                return ExamplePage();
                break;
              case AVAILABILITY.NOT_ENABLED:
                return Scaffold(
                  body: Center(
                    child: Text('NFC Not Enabled.'),
                  ),
                );
                break;
              case AVAILABILITY.NOT_SUPPORTED:
                return Scaffold(
                  body: Center(
                    child: Text('NFC Not Supported.'),
                  ),
                );
                break;
              default:
                return Scaffold(
                  body: Center(
                    child: Text('How?'),
                  ),
                );
            }
          } else {
            return Container();
          }
        },
      ),
    );
  }
}
5
likes
30
pub points
33%
popularity

Publisher

unverified uploader

A new Flutter plugin.

Repository (GitHub)
View/report issues

License

MIT (LICENSE)

Dependencies

flutter, logger

More

Packages that depend on mifare_nfc_classic