Articles in this section
Category / Section

How to generate barcodes using the Syncfusion Flutter Barcode Generator widget (SfBarcodeGenerator) ?

1 min read

Description

This article demonstrates how to create a barcode example using Syncfusion® Flutter Barcode Generator widget.

 

Solution

The Syncfusion® Flutter Barcode Generator is a data visualization widget that generate and display data in a machine-readable format. It provides an efficient approach to encode text using supported symbology types.


Follow these instructions to implement the barcode generator in your Flutter application:


 

Step 1: Create a simple project using the instructions given in the Getting Started with your first Flutter app documentation.

 

Step 2: Add the Syncfusion® Flutter Barcode dependency to your pubspec.yaml file.

 

dependencies:
 
    syncfusion_flutter_barcodes: ^xx.x.xx
 

 Replace xx.x.xx with the current version of the Syncfusion® Flutter Barcodes package.

 

Step 3: Run the following command to fetch the required packages.

$ flutter pub get

 

Step 4: Import the following package in your Dart code.

 

import 'package:syncfusion_flutter_barcodes/barcodes.dart';

 

Step 5: Add the Barcode Generator widget as a child of any widget. In this example, the widget is added as a child of a Container widget with a specified height (otherwise, it would take the full container height). The default symbology of SfBarcodeGenerator is Code128.

 

@override
    Widget build(BuildContext context) {
        return MaterialApp(
            home: Scaffold(
                body: Center(
                    child: Container(
                         height: 150,
                        child:SfBarcodeGenerator(value:'http://www.syncfusion.com')
                        )
                    )
                )      
            );
        }

 

Screenshots

 

Barcode

 

For more information on the Barcode generator, please check the user guide and API reference.


View the Github Sample here.

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied