Comments (6)
yes, it's possible if your printer support this barcode format.
i tested sucessfully on TP50 Oxhoo printer.
/// CODE128
static const code128 = BarcodeType._internal(73);
/// CODE128
///
/// k >= 2
/// d: '{A'/'{B'/'{C' => '0'–'9', A–D, a–d, $, +, −, ., /, :
Barcode.code128(List<dynamic> barcodeData) {
final k = barcodeData.length;
if (k < 2) {
throw Exception('Barcode: Wrong data range');
}
final regex = RegExp(r'^\{[A-C][\x00-\x7F]+$');
final bool isDataValid = barcodeData.every((dynamic d) => regex.hasMatch(d.toString()));
if (!isDataValid) {
throw Exception('Barcode: Data is not valid');
}
_type = BarcodeType.code128;
_data = _convertData(barcodeData);
}
and i change barcode method:
rawBytes(header + barcode.data + [0]);
by
if(barcode.type.value <= 6){
rawBytes(header + barcode.data + [0]);
}
else{
rawBytes(header + [barcode.data.length] + barcode.data);
}
usage:
{A = QRCode type A
{B = QRCode type B
{C = QRCode type C
final List barcodeData = "{A978020137962".split("");
Barcode barCode = Barcode.code128(barcodeData);
ticket.barcode(barCode);
from esc_pos_printer.
@andrey-ushakov i can give you the code for print qr code in few days
from esc_pos_printer.
@Thetyne thank you!
Can I add your code to the next release, please? Later I will create a Contributors
section in README.md and add your GitHub nickname / link.
BTW, I think this line
final bool isDataValid = barcodeData.every((dynamic d) => regex.hasMatch(d.toString()));
should be changed by
final bool isDataValid = regex.hasMatch(barcodeData.join());
from esc_pos_printer.
@andrey-ushakov yes you can add it!
from esc_pos_printer.
That would be awesome!
from esc_pos_printer.
CODE128 added to the latest release.
from esc_pos_printer.
Related Issues (20)
- Please update image plugin to ^4.0.0
- How to use Thermal printer in flutter Web HOT 1
- No option to pass COLOR CODE in style HOT 1
- can't print a long image HOT 2
- Socket has not been initialized when calling rawBytes method
- Line spacing using the ESC 3 <n> command
- Please update image plugin to ^4.0.0 HOT 2
- can you update example ? wifi has depecrated
- [ binding] Print result: Error. Printer connection timeout
- it will also work with Android POS Machine?
- FYI: esc_pos_dart
- issues after flutter upgrade to last. HOT 1
- Issue in install pakage.
- Image printing problem is slow on real device
- lineThrough
- Star Micronics SP700 / SP742 - Ethernet (Column spacing)
- Can we print Marathi language text using esc_pos_printer HOT 1
- The lower bound of "sdk: '>=2.7.0 <3.0.0'" must be 2.12.0 or higher to enable null safety.
- How to monitor printer status? HOT 1
- hr()
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from esc_pos_printer.