DavBfr / dart_barcode

Barcode generation library
https://pub.dev/packages/barcode
Apache License 2.0
132 stars 41 forks source link

how to use barcode_image in flutter ? #33

Closed ardipermana59 closed 2 years ago

ardipermana59 commented 2 years ago

https://pub.dev/packages/barcode_image/example how to use in flutter ?

void main() {
  final image = Image(600, 350);
fill(image, getColor(255, 255, 255));
drawBarcode(image, Barcode.code128(), 'Test', font: arial_24);
File('barcode.png').writeAsBytesSync(encodePng(image));
  runApp(MyApp());
}

i get it The name 'Image' is defined in the libraries 'package:flutter/src/widgets/image.dart' and 'package:image/src/image.dart (via package:image/image.dart)'. Try using 'as prefix' for one of the import directives, or hiding the name from all but one of the imports.