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

outdated

Flutter plugin that wraps Sunmi Android SDK for integrated hardware barcode scanners

example/lib/main.dart

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

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

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

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

class _MyAppState extends State<MyApp> {
  String _modelVersion = 'Unknown';

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

  // Platform messages are asynchronous, so we initialize in an async method.
  Future<void> initPlatformState() async {
    String modelVersion;
    // Platform messages may fail, so we use a try/catch PlatformException.
    try {
      modelVersion = (await SunmiBarcodePlugin().getScannerModel()).toString();
    } on PlatformException {
      modelVersion = 'Failed to get model version.';
    }

    // If the widget was removed from the tree while the asynchronous platform
    // message was in flight, we want to discard the reply rather than calling
    // setState to update our non-existent appearance.
    if (!mounted) return;

    setState(() {
      _modelVersion = modelVersion;
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Sunmi Barcode Plugin'),
        ),
        body: Center(
          child: Text('Scanner model: $_modelVersion\n'),
        ),
      ),
    );
  }
}
6
likes
40
pub points
50%
popularity

Publisher

verified publisherintegrator.hr

Flutter plugin that wraps Sunmi Android SDK for integrated hardware barcode scanners

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

flutter

More

Packages that depend on sunmi_barcode_plugin