zkc_scanner 2.0.1+6 copy "zkc_scanner: ^2.0.1+6" to clipboard
zkc_scanner: ^2.0.1+6 copied to clipboard

PlatformAndroid
outdated

A Flutter plugin for barcode scanning with ZKC PDAs.

example/lib/main.dart

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

void main() => runApp(const MyApp());

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

  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> implements ScannerCallBack{
  final zkcScanner = ZKCScanner();
  String? _scannedCode = 'Empty';
  String _scannedStatus = 'Stopped';

  @override
  void initState() {
    super.initState();
    zkcScanner.scannerCallBack = this;
  }

  @override
  void onDecoded(String? result) {
    setState(() {
      _scannedCode = result;
    });
  }

  @override
  void onError(Exception error) {
    setState(() {
      _scannedCode = error.toString();
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            Text('Scanner: $_scannedStatus'),
            const Divider(color: Colors.transparent,),
            Text('Scanned code: $_scannedCode'),
            const Divider(color: Colors.transparent,),
            ElevatedButton(
              child: const Text("Start Scanner"),
              onPressed: (){
                zkcScanner.startScanner();
                _scannedStatus = "Started";
                setState(() {});
              },
            ),
            const SizedBox(height: 16,),
            ElevatedButton(
              child: const Text("Stop Scanner"),
              onPressed: (){
                zkcScanner.stopScanner();
                _scannedStatus = "Stopped";
                setState(() {});
              },
            ),
          ],
        ),
      ),
    );
  }
}
4
likes
140
pub points
16%
popularity

Publisher

verified publisherdev.lamt.dev

A Flutter plugin for barcode scanning with ZKC PDAs.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter

More

Packages that depend on zkc_scanner