ehsure_pda_plugin 1.0.0 copy "ehsure_pda_plugin: ^1.0.0" to clipboard
ehsure_pda_plugin: ^1.0.0 copied to clipboard

An Ehsure PDA Flutter plugin.

example/lib/main.dart

import 'package:ehsure_pda_plugin/ehsure_pda_plugin.dart';
import 'package:flutter/material.dart';
import 'dart:convert' as convert;

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

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

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

  @override
  void initState() {
    super.initState();
    _register();
    EhsurePdaPlugin.EHSURE_SCANNER_CHANNEL.setMessageHandler(
          (String message) => Future<String>(() {
        setState(() {
          _erCodeValue = message;
        });
        return message;
      }),
    );
  }

  void _register() async {
    var pdaInfo = { EhsurePdaPlugin.ACTION_KEY: EhsurePdaPlugin.ACTION_VALUE,
      EhsurePdaPlugin.EXTRA_KEY: EhsurePdaPlugin.EXTRA_VALUE};
    String pdaInfoJsonStr = convert.jsonEncode(pdaInfo);
    await EhsurePdaPlugin.EHSURE_SCANNER_CHANNEL.send(pdaInfoJsonStr);
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: Text('ErCode is: $_erCodeValue\n'),
        ),
      ),
    );
  }
}
2
likes
20
pub points
21%
popularity

Publisher

unverified uploader

An Ehsure PDA Flutter plugin.

Homepage

License

unknown (LICENSE)

Dependencies

characters, flutter

More

Packages that depend on ehsure_pda_plugin