flutter_honeywell_captuvo_plugin 0.1.1 copy "flutter_honeywell_captuvo_plugin: ^0.1.1" to clipboard
flutter_honeywell_captuvo_plugin: ^0.1.1 copied to clipboard

outdated

Flutter wrapper for the Honeywell Captuvo SL22/42 barcode scanners iOS API.

example/lib/main.dart

import 'dart:async';

import 'package:flutter/material.dart';

import 'package:flutter_honeywell_captuvo_plugin/flutter_honeywell_captuvo_plugin.dart';

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

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

class _MyAppState extends State<MyApp> {
  StreamSubscription decoderConnectionStreamubscription;

  @override
  void initState() {
    super.initState();
    FlutterHoneywellCaptuvoPlugin.startDecoderHardware();
    decoderConnectionStreamubscription = FlutterHoneywellCaptuvoPlugin
        .decoderConnectionStream
        .listen((isConnected) {
      if (isConnected) {
        FlutterHoneywellCaptuvoPlugin.startDecoderHardware();
      }
    });
  }

  @override
  void dispose() {
    decoderConnectionStreamubscription?.cancel();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Captuvo SL42 API Example'),
        ),
        body: Padding(
          padding: const EdgeInsets.all(16.0),
          child: Center(
            child: Column(
              mainAxisAlignment: MainAxisAlignment.center,
              children: <Widget>[
                StreamBuilder<bool>(
                  stream: FlutterHoneywellCaptuvoPlugin.decoderConnectionStream,
                  initialData: false,
                  builder: (_, snapshot) => Text(
                      'Decoder is ${snapshot.data ? "Conencted" : "Disconnected"}'),
                ),
                const SizedBox(height: 10.0),
                StreamBuilder<String>(
                  stream: FlutterHoneywellCaptuvoPlugin.decoderScanDataStream,
                  initialData: "NONE",
                  builder: (_, snapshot) =>
                      Text('Last scan data: ${snapshot.data}'),
                ),
              ],
            ),
          ),
        ),
        floatingActionButton: GestureDetector(
          child: Container(
            height: 100.0,
            width: 100.0,
            decoration: BoxDecoration(
              color: Colors.blue,
              borderRadius: BorderRadius.circular(50.0),
            ),
            child: Icon(Icons.scanner),
          ),
          onTapDown: (_) =>
              FlutterHoneywellCaptuvoPlugin.startDecoderScanning(),
          onTapUp: (_) => FlutterHoneywellCaptuvoPlugin.stopDecoderScanning(),
        ),
      ),
    );
  }
}
0
likes
40
pub points
30%
popularity

Publisher

unverified uploader

Flutter wrapper for the Honeywell Captuvo SL22/42 barcode scanners iOS API.

Homepage

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on flutter_honeywell_captuvo_plugin