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

PlatformAndroidiOS
outdated

GaziBilisim 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;

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

  Future<void> cardRead() async {
    GBPosNfc.readCard().listen((PosNfcData cardInfo) {
      setState(() {
        _cardID = 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'),
            ),
          ],
        ),
      ),
    );
  }
}
4
likes
140
points
21
downloads

Publisher

verified publisherismailunal.net

Weekly Downloads

GaziBilisim POS NFC Card Reader

Homepage

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on flutter_gb_pos_nfc