flutter_star_prnt 1.0.4

  • Readme
  • Changelog
  • Example
  • Installing
  • 72

flutter_star_prnt #

Pub Version

Flutter plugin for Star micronics printers.

Native code based on React Native and Ionic/Cordova version
React native Version ➜ here
Ionic/Cordova Version ➜ here

Getting Started #

import 'package:flutter_star_prnt/flutter_star_prnt.dart';

// Find printers
List<PortInfo> list = await StarPrnt.portDiscovery(StarPortType.All);

list.forEach((port) async {
/// Check status
await StarPrnt.checkStatus(portName: port.portName,emulation: 'StarGraphic',)
}

///send print commands to printer
PrintCommands commands = PrintCommands();
commands.push({
 'appendBitmapText': "Hello World"
});
commands.push({
 'appendCutPaper': "FullCutWithFeed"
});
await StarPrnt.print(portName: port.portName, emulation: 'StarGraphic',printCommands: commands)

Android #

Permissions required depending on your printer:

<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<uses-permission android:name="android.permission.BLUETOOTH"></uses-permission>

Work in progress #

  • [ ] Connect/disconnect function for persistent connection
  • [ ] Helper function on appending print commands

Documentation work in progress, please refer to react native or Ionic/Cordova's documentations for command format #

1.0.4 #

  • Fixed crash cause by exceptions on android

1.0.3 #

  • Fixed unable to find dependency on ios

1.0.2 #

  • Fixed The 'Pods-Runner' target has transitive dependencies that include static frameworks bug

1.0.1 #

  • Fixed Star sdk pod version for IOS

1.0.0 #

  • Added portDiscovery, checkstatus and print function

example/lib/main.dart

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

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

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

class _MyAppState extends State<MyApp> {
  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: FlatButton(
              onPressed: () async {
                List<PortInfo> list =
                    await StarPrnt.portDiscovery(StarPortType.All);
                print(list);
                list.forEach((port) async {
                  print(port.portName);
                  if (port.portName.isNotEmpty) {
                    print(await StarPrnt.checkStatus(
                      portName: port.portName,
                      emulation: 'StarGraphic',
                    ));

                    PrintCommands commands = PrintCommands();
                    Map<String, dynamic> rasterMap = {
                      'appendBitmapText': "        Star Clothing Boutique\n" +
                          "             123 Star Road\n" +
                          "           City, State 12345\n" +
                          "\n" +
                          "Date:MM/DD/YYYY          Time:HH:MM PM\n" +
                          "--------------------------------------\n" +
                          "SALE\n" +
                          "SKU            Description       Total\n" +
                          "300678566      PLAIN T-SHIRT     10.99\n" +
                          "300692003      BLACK DENIM       29.99\n" +
                          "300651148      BLUE DENIM        29.99\n" +
                          "300642980      STRIPED DRESS     49.99\n" +
                          "30063847       BLACK BOOTS       35.99\n" +
                          "\n" +
                          "Subtotal                        156.95\n" +
                          "Tax                               0.00\n" +
                          "--------------------------------------\n" +
                          "Total                           156.95\n" +
                          "--------------------------------------\n" +
                          "\n" +
                          "Charge\n" +
                          "156.95\n" +
                          "Visa XXXX-XXXX-XXXX-0123\n" +
                          "Refunds and Exchanges\n" +
                          "Within 30 days with receipt\n" +
                          "And tags attached\n",
                    };
                    commands.push(rasterMap);
                    print(await StarPrnt.print(
                        portName: port.portName,
                        emulation: 'StarGraphic',
                        printCommands: commands));
                  }
                });
              },
              child: Text('test')),
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  flutter_star_prnt: ^1.0.4

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:flutter_star_prnt/flutter_star_prnt.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
44
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
72
Learn more about scoring.

We analyzed this package on Jul 8, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.14
  • Flutter: 1.17.5

Analysis suggestions

Package does not support Flutter platform linux

Because:

  • package:flutter_star_prnt/flutter_star_prnt.dart that declares support for platforms: android, ios

Package does not support Flutter platform macos

Because:

  • package:flutter_star_prnt/flutter_star_prnt.dart that declares support for platforms: android, ios

Package does not support Flutter platform web

Because:

  • package:flutter_star_prnt/flutter_star_prnt.dart that declares support for platforms: android, ios

Package does not support Flutter platform windows

Because:

  • package:flutter_star_prnt/flutter_star_prnt.dart that declares support for platforms: android, ios

Package not compatible with SDK dart

Because:

  • flutter_star_prnt that is a package requiring null.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.6.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.12 1.14.13
meta 1.1.8 1.2.1
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8 2.1.0-nullsafety
Dev dependencies
flutter_test