Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
shirne committed Jun 19, 2021
1 parent 51bb5da commit 22a95ee
Show file tree
Hide file tree
Showing 17 changed files with 54 additions and 67 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## [0.3.1] - 2021-06-19

* remove flutter dependencies
* add latin2~15 encoding

## [0.3.0] - 2021-06-16

* fix datamatrix encode
Expand Down
10 changes: 4 additions & 6 deletions lib/src/client/result/result_parser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@

import 'dart:convert';

import 'package:flutter/cupertino.dart';

import 'product_result_parser.dart';
import 'smsmmsresult_parser.dart';
import 'smstommstoresult_parser.dart';
Expand Down Expand Up @@ -112,12 +110,12 @@ abstract class ResultParser {
return text;
}

@protected
//@protected
List<String>? maybeWrap(String? value) {
return value == null ? null : [ value ];
}

@protected
//@protected
String unescapeBackslash(String escaped) {
int backslash = escaped.indexOf('\\');
if (backslash < 0) {
Expand All @@ -139,7 +137,7 @@ abstract class ResultParser {
return unescaped.toString();
}

@protected
//@protected
static int parseHexDigit(String chr) {
int c = chr.codeUnitAt(0);
if (c >= 48 /*'0'*/ && c <= 57 /*'9'*/) {
Expand All @@ -154,7 +152,7 @@ abstract class ResultParser {
return -1;
}

@protected
//@protected
bool isStringOfDigits(String? value, int length) {
return value != null && length > 0 && length == value.length && _digits.hasMatch(value);
}
Expand Down
3 changes: 1 addition & 2 deletions lib/src/common/grid_sampler.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
* limitations under the License.
*/

import 'package:flutter/cupertino.dart';

import '../not_found_exception.dart';
import 'bit_matrix.dart';
Expand Down Expand Up @@ -117,7 +116,7 @@ abstract class GridSampler {
/// @param image image into which the points should map
/// @param points actual points in x1,y1,...,xn,yn form
/// @throws NotFoundException if an endpoint is lies outside the image boundaries
@protected
//@protected
static checkAndNudgePoints(BitMatrix image, List<double> points) {
int width = image.width;
int height = image.height;
Expand Down
3 changes: 1 addition & 2 deletions lib/src/oned/coda_bar_writer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
* limitations under the License.
*/

import 'package:flutter/cupertino.dart';

import '../common/detector/math_utils.dart';

Expand All @@ -36,8 +35,8 @@ class CodaBarWriter extends OneDimensionalCodeWriter {
];
static const String _DEFAULT_GUARD = 'A';//START_END_CHARS[0];

//@protected
@override
@protected
List<BarcodeFormat> get supportedWriteFormats => [BarcodeFormat.CODABAR];

@override
Expand Down
6 changes: 2 additions & 4 deletions lib/src/oned/code128_writer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
* limitations under the License.
*/

import 'package:flutter/cupertino.dart';

import '../barcode_format.dart';
import 'code128_reader.dart';
Expand Down Expand Up @@ -46,10 +45,9 @@ class Code128Writer extends OneDimensionalCodeWriter {
static const int _CODE_FNC_4_A = 101; // Code A
static const int _CODE_FNC_4_B = 100; // Code B

// Results of minimal lookahead for code C

/// Results of minimal lookahead for code C
//@protected
@override
@protected
List<BarcodeFormat> get supportedWriteFormats => [BarcodeFormat.CODE_128];

@override
Expand Down
5 changes: 2 additions & 3 deletions lib/src/oned/code93_writer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,15 @@
* limitations under the License.
*/

import 'package:flutter/cupertino.dart';

import '../barcode_format.dart';
import 'code93_reader.dart';
import 'one_dimensional_code_writer.dart';

/// This object renders a CODE93 code as a BitMatrix
class Code93Writer extends OneDimensionalCodeWriter {

// @protected
@override
@protected
List<BarcodeFormat> get supportedWriteFormats => [BarcodeFormat.CODE_93];

/// @param contents barcode contents to encode. It should not be encoded for extended characters.
Expand Down
3 changes: 1 addition & 2 deletions lib/src/oned/ean13_writer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
* limitations under the License.
*/

import 'package:flutter/cupertino.dart';

import '../barcode_format.dart';
import '../formats_exception.dart';
Expand All @@ -34,8 +33,8 @@ class EAN13Writer extends UPCEANWriter {
(7 * 6) + // right bars
3; // end guard

// @protected
@override
@protected
List<BarcodeFormat> get supportedWriteFormats => [BarcodeFormat.EAN_13];

@override
Expand Down
3 changes: 1 addition & 2 deletions lib/src/oned/ean8_writer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
* limitations under the License.
*/

import 'package:flutter/cupertino.dart';

import '../barcode_format.dart';
import '../formats_exception.dart';
Expand All @@ -32,8 +31,8 @@ class EAN8Writer extends UPCEANWriter {
(7 * 4) + // right bars
3; // end guard

// @protected
@override
@protected
List<BarcodeFormat> get supportedWriteFormats => [BarcodeFormat.EAN_8];

/// @return a byte array of horizontal pixels (false = white, true = black)
Expand Down
3 changes: 1 addition & 2 deletions lib/src/oned/itfwriter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/


import 'package:flutter/cupertino.dart';

import '../barcode_format.dart';
import 'one_dimensional_code_writer.dart';
Expand Down Expand Up @@ -45,8 +44,8 @@ class ITFWriter extends OneDimensionalCodeWriter {
[_N, _W, _N, _W, _N] // 9
];

// @protected
@override
@protected
List<BarcodeFormat> get supportedWriteFormats => [BarcodeFormat.ITF];

@override
Expand Down
25 changes: 12 additions & 13 deletions lib/src/oned/rss/abstract_rssreader.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
* limitations under the License.
*/

import 'package:flutter/cupertino.dart';

import '../../common/detector/math_utils.dart';

Expand All @@ -37,7 +36,7 @@ abstract class AbstractRSSReader extends OneDReader {
final List<int> _oddCounts;
final List<int> _evenCounts;

@protected
// @protected
AbstractRSSReader()
: _decodeFinderCounters = List.filled(4, 0),
_dataCharacterCounters = List.filled(8, 0),
Expand All @@ -46,25 +45,25 @@ abstract class AbstractRSSReader extends OneDReader {
_oddCounts = List.filled(4, 0),
_evenCounts = List.filled(4, 0);

@protected
// @protected
List<int> get decodeFinderCounters => _decodeFinderCounters;

@protected
// @protected
List<int> get dataCharacterCounters => _dataCharacterCounters;

@protected
// @protected
List<double> get oddRoundingErrors => _oddRoundingErrors;

@protected
// @protected
List<double> get evenRoundingErrors => _evenRoundingErrors;

@protected
// @protected
List<int> get oddCounts => _oddCounts;

@protected
// @protected
List<int> get evenCounts => _evenCounts;

@protected
// @protected
static int parseFinderValue(
List<int> counters, List<List<int>> finderPatterns) {
for (int value = 0; value < finderPatterns.length; value++) {
Expand All @@ -80,13 +79,13 @@ abstract class AbstractRSSReader extends OneDReader {
/// @param array values to sum
/// @return sum of values
/// @deprecated call {@link MathUtils#sum(List<int>)}
// @protected
@deprecated
@protected
static int count(List<int> array) {
return MathUtils.sum(array);
}

@protected
// @protected
static void increment(List<int> array, List<double> errors) {
int index = 0;
double biggestError = errors[0];
Expand All @@ -99,7 +98,7 @@ abstract class AbstractRSSReader extends OneDReader {
array[index]++;
}

@protected
// @protected
static void decrement(List<int> array, List<double> errors) {
int index = 0;
double biggestError = errors[0];
Expand All @@ -112,7 +111,7 @@ abstract class AbstractRSSReader extends OneDReader {
array[index]--;
}

@protected
// @protected
static bool isFinderPattern(List<int> counters) {
int firstTwoSum = counters[0] + counters[1];
int sum = firstTwoSum + counters[2] + counters[3];
Expand Down
5 changes: 2 additions & 3 deletions lib/src/oned/rss/expanded/decoders/ai013103decoder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
* http://www.piramidepse.com/
*/

import 'package:flutter/cupertino.dart';

import '../../../../common/bit_array.dart';

Expand All @@ -34,14 +33,14 @@ import 'ai013x0x_decoder.dart';
class AI013103decoder extends AI013x0xDecoder {
AI013103decoder(BitArray information) : super(information);

//@protected
@override
@protected
void addWeightCode(StringBuffer buf, int weight) {
buf.write("(3103)");
}

//@protected
@override
@protected
int checkWeight(int weight) {
return weight;
}
Expand Down
5 changes: 2 additions & 3 deletions lib/src/oned/rss/expanded/decoders/ai01320x_decoder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
* http://www.piramidepse.com/
*/

import 'package:flutter/cupertino.dart';

import '../../../../common/bit_array.dart';

Expand All @@ -34,8 +33,8 @@ import 'ai013x0x_decoder.dart';
class AI01320xDecoder extends AI013x0xDecoder {
AI01320xDecoder(BitArray information) : super(information);

//@protected
@override
@protected
void addWeightCode(StringBuffer buf, int weight) {
if (weight < 10000) {
buf.write("(3202)");
Expand All @@ -44,8 +43,8 @@ class AI01320xDecoder extends AI013x0xDecoder {
}
}

//@protected
@override
@protected
int checkWeight(int weight) {
if (weight < 10000) {
return weight;
Expand Down
5 changes: 2 additions & 3 deletions lib/src/oned/rss/expanded/decoders/ai013x0x1x_decoder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
* http://www.piramidepse.com/
*/

import 'package:flutter/cupertino.dart';

import '../../../../common/bit_array.dart';
import '../../../../common/string_builder.dart';
Expand Down Expand Up @@ -96,17 +95,17 @@ class AI013x0x1xDecoder extends AI01weightDecoder {
buf.write(day);
}

//@protected
@override
@protected
void addWeightCode(StringBuffer buf, int weight) {
buf.write('(');
buf.write(this._firstAIdigits);
buf.write(weight ~/ 100000);
buf.write(')');
}

//@protected
@override
@protected
int checkWeight(int weight) {
return weight % 100000;
}
Expand Down
5 changes: 2 additions & 3 deletions lib/src/oned/rss/expanded/decoders/ai01weight_decoder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
* http://www.piramidepse.com/
*/

import 'package:flutter/cupertino.dart';

import '../../../../common/bit_array.dart';

Expand Down Expand Up @@ -53,9 +52,9 @@ abstract class AI01weightDecoder extends AI01decoder {
buf.write(weightNumeric);
}

@protected
//@protected
void addWeightCode(StringBuffer buf, int weight);

@protected
//@protected
int checkWeight(int weight);
}
7 changes: 3 additions & 4 deletions lib/src/oned/upcereader.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
* limitations under the License.
*/

import 'package:flutter/cupertino.dart';

import '../common/bit_array.dart';
import '../common/string_builder.dart';
Expand Down Expand Up @@ -70,8 +69,8 @@ class UPCEReader extends UPCEANReader {

UPCEReader();

//@protected
@override
@protected
int decodeMiddle(BitArray row, List<int> startRange, StringBuilder result) {
List<int> counters = _decodeMiddleCounters;
counters[0] = 0;
Expand Down Expand Up @@ -100,14 +99,14 @@ class UPCEReader extends UPCEANReader {
return rowOffset;
}

//@protected
@override
@protected
List<int> decodeEnd(BitArray row, int endStart) {
return UPCEANReader.findGuardPattern(row, endStart, true, _MIDDLE_END_PATTERN);
}

//@protected
@override
@protected
bool checkChecksum(String s) {
return super.checkChecksum(convertUPCEtoUPCA(s));
}
Expand Down
Loading

0 comments on commit 22a95ee

Please sign in to comment.