sunmi_scanner 0.0.6 copy "sunmi_scanner: ^0.0.6" to clipboard
sunmi_scanner: ^0.0.6 copied to clipboard

PlatformAndroid

Sunmi support package that allows you to easily interface with your scanner device

example/lib/main.dart

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

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

class MyApp extends StatefulWidget {
  const MyApp({super.key});

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

class _MyAppState extends State<MyApp> {
  String? scannedValue;

  void _setScannedValue(String value) {
    setState(() {
      scannedValue = value;
    });
  }

  @override
  void initState() {
    super.initState();
    SunmiScanner.onBarcodeScanned().listen((event) {
      _setScannedValue(event);
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.stretch,
            children: [
              Center(
                child: Text("scanning: ${scannedValue ?? ""}"),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
5
likes
160
pub points
82%
popularity

Publisher

verified publisherfrancescodema.dev

Sunmi support package that allows you to easily interface with your scanner device

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on sunmi_scanner