bigship / barcode.flutter

barcode generate library for Flutter
BSD 2-Clause "Simplified" License
59 stars 27 forks source link

EAN8 with error #11

Closed AndrewPiterov closed 5 years ago

AndrewPiterov commented 5 years ago

Hi! I try to display an EAN-8 barcode with value '90311130'. But I get an exception 'RangeError (index): Invalid value: Not in range 0..9, inclusive: 10'

return Center( child: Container( child: BarCodeImage( data: '90311130', codeType: BarCodeType.CodeEAN8, barHeight: 100.0, hasText: true, onError: (error) { print("Generate barcode failed. error msg: $error"); }, ), ));

Exception:

════════ Exception caught by rendering library ═════════════════════════════════ The following RangeError was thrown during paint(): RangeError (index): Invalid value: Not in range 0..9, inclusive: 10

User-created ancestor of the error-causing widget was BarCodeImage lib/pages/mobil_cards.dart:392 When the exception was thrown, this was the stack

0 List.[] (dart:core-patch/growable_array.dart:147:60)

1 BarCodePainter._drawBarCodeEAN8

package:barcode_flutter/src/barcode_painter.dart:574

2 BarCodePainter.paint

package:barcode_flutter/src/barcode_painter.dart:30

3 RenderCustomPaint._paintWithPainter

package:flutter/…/rendering/custom_paint.dart:528

4 RenderCustomPaint.paint

package:flutter/…/rendering/custom_paint.dart:566 ... The following RenderObject was being processed when the exception was fired: RenderCustomPaint#74661 RenderObject: RenderCustomPaint#74661 parentData: offset=Offset(5.0, 5.0) (can use size) constraints: BoxConstraints(w=152.0, h=98.0) size: Size(152.0, 98.0) ════════════════════════════════════════════════════════════════════════════════

bigship commented 5 years ago

Hi, there's a fix on that issue. Please update to version 1.0.2 EAN-8 barcode with value '90311130' can render OK and scan correctly now. I'll close this issue.