flutter_gb_pos_nfc 0.0.2 copy "flutter_gb_pos_nfc: ^0.0.2" to clipboard
flutter_gb_pos_nfc: ^0.0.2 copied to clipboard

Uruvo POS NFC Card Reader

example/lib/main.dart

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

import 'package:flutter/services.dart';
import 'package:flutter_gb_pos_nfc/flutter_gb_pos_nfc.dart';

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

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  String? _cardID;
  TextEditingController testController = TextEditingController();

  @override
  void initState() {
    super.initState();
  }

  Future<void> cardRead() async {
    GBPosNfc.readCard().listen((PosNfcData cardInfo) {
      setState(() {
        _cardID = cardInfo.id;
        testController.text = cardInfo.id ?? "-";
      });
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Column(
          mainAxisAlignment: MainAxisAlignment.spaceAround,
          children: [
            MaterialButton(
              child: const Text(
                "Read",
                style: TextStyle(
                  color: Colors.white,
                  fontSize: 20,
                ),
              ),
              onPressed: () async {
                cardRead();
              },
              color: Colors.green,
            ),
            Center(
              child: Text('Card ID: $_cardID\n'),
            ),
            TextField(
              controller: testController,
              maxLines: 8,
            ),
          ],
        ),
      ),
    );
  }
}
4
likes
140
points
22
downloads

Publisher

verified publisherismailunal.net

Weekly Downloads

Uruvo POS NFC Card Reader

Homepage

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on flutter_gb_pos_nfc