esc_pos_dart 1.3.2
esc_pos_dart: ^1.3.2 copied to clipboard
ESC/POS thermal WiFi printer support for Dart (non-Flutter dependent).
1.3.2 #
-
PrinterDocument:- Added
fontTypefield with default'a'. - Updated constructor to accept
fontTypeparameter, normalizing to lowercase and trimming. - Updated
fromJsonandtoJsonto includefontType. - Updated
printmethod to applyfontTypealong withfontSizein styles and printer commands.
- Added
-
Generator:- Updated
getCharsPerLineto accept named parameters and apply font width scaling conditionally. - Updated
getCharWidthto pass named parametermaxCharsPerLine. - Updated
hrmethod to calculate line length considering font width scaling.
- Updated
1.3.1 #
-
PrinterDocument:print: added optionalselectCharCodeTableparameter.print: pass initialPosStyleswith font size toprinter.reset().print: ensurefontSizestyle is applied viaprinter.setStyles().
-
PrinterCommandStyle:- Changed all fields to nullable.
- Added
constconstructor anddefaultsconstructor. fromJson: no longer provide default values; fields nullable.toJson: serialize only non-null fields.toPosStyles: treat null booleans as false; convert nullable width/height toPosTextSizeor null.- Removed internal
getPosTextSizemethod.
-
GenericPrinter:resetmethod now accepts optionalPosStylesparameter and passes it to generator.
-
DecoderEscPos:- Added support for GS command 0x21 to decode font size.
- Added
CommandEscPosFontSizecommand with width and height size parameters. - Updated
CommandEscPos.fromJsonto supportfont-sizecommand.
-
enums.dart:- Added
PosTextSize.encodeSizeto encode width and height into a single int. - Added
PosTextSize.decodeSizeto decode int into width and heightPosTextSizevalues.
- Added
-
Generator:resetnow accepts optionalPosStylesparameter.- Added
setAlignmethod with optionalforceparameter. - Updated
setGlobalCodeTableandsetFontto acceptforceparameter. - Updated
setStylesto handle nullable width and height, and encode font size usingPosTextSize.encodeSize. - Updated
getCharWidthandgetCharsPerLineto handle nullable width and global styles fallback.
-
GeneratorEscPos:- Implemented
resetwith optionalstylesparameter, applying initial styles with defaults. - Implemented
setAlignto update alignment if changed or forced. - Updated
setStylesto handle nullable height and width, and encode font size accordingly.
- Implemented
-
PosStyles:-
Made
heightandwidthnullable. -
Added
copyWithDefaultsmethod to fill null fields from defaults or parameters. -
Updated constructors to allow nullable height and width.
-
PosTextSize:- Added static method
withValue(int value)to return aPosTextSizeenum matching the given value or null if none matches.
- Added static method
-
1.3.0 #
-
PrinterDocument:- Added
fontSizefield with clamped range 1 to 8. - Updated constructor to accept optional
fontSizeparameter.- Breaking change: The constructor now uses named parameters.
- Updated
fromJsonandtoJsonto handlefontSize.
- Added
-
Generator:- Updated
getCharsPerLineto adjust character count based onPosStyles.widthscaling.
- Updated
-
Dependencies:
- Updated
imageto ^4.8.0. - Updated
testto ^1.30.0. - Updated
dependency_validatorto ^5.0.4.
- Updated
1.2.1 #
-
PrinterDocument:print: added optional parameterselectCharCodeTableto select character code table before printing.
-
GenericPrinter:- Added method
selectCharCodeTable({int codeTable = 0})to send ESC/POS command to select character code table.
- Added method
-
Generator(abstract):- Added methods and properties for character code table support:
selectCharCodeTable({int codeTable = 0})int? get selectedCharCodeTableString? get selectedCharsetCharsetEncoder? get selectedCharsetEncoder
- Added methods and properties for character code table support:
-
GeneratorEscPos:- Implemented character code table selection and tracking:
_selectedCharCodeTable,_selectedCharset,_selectedCharsetEncoderfields.selectCharCodeTableupdates selected table and charset encoder.resetclears selected character code table.
- Added enum
CharCodeTableEscPosmapping ESC/POS code tables to charset names and encoders. - Updated text encoding to use selected charset encoder if available.
- Implemented character code table selection and tracking:
-
char_encoder.dart:- Added comprehensive charset encoder resolution via
getCharsetEncoder(String? name)usingcharsetpackage. - Updated
encodeCharsto accept optionalCharsetEncoderor charset name and fallback to latin1 or utf8 if encoding fails.
- Added comprehensive charset encoder resolution via
-
Dependency updates:
- Added
charset: ^2.0.1 - Updated
imageto ^4.7.2 - Updated
collectionto ^1.19.1 - Updated
testto ^1.29.0 - Updated
dependency_validatorto ^5.0.3 - Updated
coverageto ^1.15.0
- Added
1.2.0 #
-
Migrate to
image: ^4.5.4. -
image: ^4.5.4
-
test: ^1.26.2
-
dependency_validator: ^5.0.2
-
coverage: ^1.14.1
1.1.3 #
-
DecoderEscPos:- Fix decoding of Bit Image, calculating the correct data length.
-
CommandEscPosBitImage:- Added field
lineBreak.
- Added field
-
coverage: ^1.13.1
1.1.2 #
-
Generator:- Fix
getCharsPerLineto usestyles.fontType. cut: change parameter toextraLines = 4.hr: fix call togetMaxCharsPerLineto usestyles.fontType ?? globalFont.
- Fix
-
GeneratorEscPos:- Consider character margin for max characters per line.
-
PrinterCommandHR:- Fix JSON: add parameter
style.
- Fix JSON: add parameter
-
PrinterCommandImage:- Added
decodeImage. - Fix JSON: add parameter
mimeType.
- Added
1.1.1 #
Generator:cut: rollback default value forextraLinesto3. Most printers need at least 3 extra lines.
1.1.0 #
-
Converted to Dart enums:
PaperSize,PosTextSize,PosBeepDuration.
-
PosStyles:alignnullable.fontTypenullable.
-
Generatornow is a base class.- Added fields
newLineandnormalizeNewLines. - Renamed
setGlobalFonttosetFont. - Added
styledBlock. cut: parameterextraLines = 2.globalFontnow is a getter toglobalStyles.fontType ?? PosFontType.fontA.- Implementation:
GeneratorEscPos(ESC/POS)- Ensure that command styles won't affect global style.
- Added fields
-
New
DecoderandDecoderEscPos. -
PrinterCommandStyle:- Field
alignnow is aPosAlign. - Field
fontTypenow is aPosFontType.
- Field
-
PrinterDocument:print:- Added parameters
resetandendJob. - Send a
resetcommand before start printing. - Send a
endJobcommand at the end of printing.
- Added parameters
addHR: added parameterstyle.
-
collection: ^1.19.0
-
lints: ^5.1.1
1.0.6 #
🚀 Refactor: Refactor NetworkPrinter into GenericPrinter class.
🚀 New BytesPrinter.
-
sdk: ^3.6.0
-
resource_portable: ^3.1.2
-
test: ^1.25.15
-
coverage: ^1.11.1
-
intl: ^0.20.2
1.0.5 #
-
New
encodeChars, to avoid encoding errors. -
Optimize imports.
-
image: ^3.3.0
-
resource_portable: ^3.1.0
-
collection: ^1.18.0
-
lints: ^4.0.0
-
test: ^1.25.11
-
dependency_validator: ^3.2.3
-
coverage: ^1.11.0
-
intl: ^0.20.1
1.0.4 #
- Fix
NetworkPrinter.disconnectdelay.
1.0.3 #
- Added support to optional command
GS r(transmission of status). - Added
end jobcommand. - Added
NetworkPrinter.ensureConnected.
1.0.2 #
- Added
PrinterCommand.toString. - Fixed load of resource:
package:esc_pos_dart/resources/capabilities.json. - collection: ^1.17.2
1.0.1 #
- New
PrinterDocument.
1.0.0 #
- Dart pure version:
- Adjusted for Dart 3.
- Removed any Flutter dependency.
- Fixed lints.
- Added full printing example.
Original Work #
This package is based on the packages esc_pos_printer and esc_pos_utils by Andrey Ushakov (andrey-ushakov@GitHub). Both packages are Flutter dependent, which makes it impossible to use in Dart pure applications.