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

outdated

Add printer mldule.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:ty_smart_pos_api_plugin/ty_smart_pos_api_plugin.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 _result = '';
  final _tySmartPosApiPlugin = TySmartPosApiPlugin();

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Column(children: <Widget>[
          ElevatedButton(
            onPressed: () async {
              _result = await _tySmartPosApiPlugin.getDeviceKSN() ?? 'N/A';
              setState(() {});
            },
            style: ElevatedButton.styleFrom(
                padding: const EdgeInsets.all(10),
                minimumSize: const Size(double.infinity, 30)),
            child: const Text('Test Button'),
          ),
          Text(_result)
        ]),
      ),
    );
  }
}