Syncfusion Flutter Barcode Generator
This skill covers the Syncfusion Flutter Barcode Generator component (SfBarcodeGenerator) for creating machine-readable barcodes. The widget supports 14 different barcode symbologies including popular 1D barcodes (Code128, EAN, UPC, etc.) and 2D barcodes (QR Code, Data Matrix).
When to Use This Skill
Use this skill when you need to:
- Generate barcodes for products, assets, or documents
- Implement QR codes for URLs, contact info, or payments
- Create product labels with retail barcodes (EAN, UPC)
- Build inventory systems with barcode tracking
- Generate Data Matrix codes for compact data encoding
- Add barcode scanning integration to your Flutter apps
- Create tickets or vouchers with unique barcode identifiers
- Implement asset tracking with barcode labels
- Generate barcodes for documents or identification cards
- Customize barcode appearance with colors, text, and styling
- Support multiple barcode formats in a single application
- Display machine-readable codes for data input workflows
Component Overview
SfBarcodeGenerator is a data visualization widget designed to generate and display data in a machine-readable format. It provides:
- 14 Barcode Symbologies - 12 one-dimensional and 2 two-dimensional types
- Customizable Appearance - Colors, text styling, spacing, and bar width control
- Easy Integration - Simple API with minimal configuration
- Accessibility Support - Sufficient contrast and large fonts support
- Flexible Sizing - Automatic or manual module (bar width) configuration
- Text Display - Show/hide input values with custom formatting
Supported Barcode Types
One-Dimensional (1D) Barcodes - 12 Types
| Barcode Type |
Character Support |
Typical Use Cases |
| Codabar |
Numeric + special chars (-, :, /, +) |
Libraries, blood banks, shipping |
| Code39 |
Alphanumeric (uppercase) + symbols |
Automotive, defense, healthcare |
| Code39Extended |
Full ASCII (all 128 characters) |
Extended character encoding |
| Code93 |
Alphanumeric + symbols |
Compact encoding, logistics |
| Code128 |
Full ASCII (automatic mode) |
Most versatile, shipping, packaging |
| Code128A |
ASCII 0-95 (uppercase + control) |
Control character encoding |
| Code128B |
ASCII 32-127 (upper + lowercase) |
Standard text encoding |
| Code128C |
Numeric pairs (00-99) |
Numeric data, double density |
| UPCA |
12-digit numeric |
Retail products (North America) |
| UPCE |
8-digit numeric (compact) |
Small package retail products |
| EAN13 |
13-digit numeric |
International retail products |
| EAN8 |
8-digit numeric |
Small retail products |
Two-Dimensional (2D) Barcodes - 2 Types
| Barcode Type |
Data Capacity |
Typical Use Cases |
| QR Code |
Up to 7,089 numeric or 4,296 alphanumeric |
URLs, contact info, payments, marketing |
| Data Matrix |
Up to 3,116 numeric or 2,335 alphanumeric |
Electronics, pharmaceuticals, printed media |
QR Code Features:
- Error correction levels (Low, Medium, Quartile, High)
- Input modes (Numeric, Alphanumeric, Binary, Kanji)
- Version 1-40 (21x21 to 177x177 modules)
Data Matrix Features:
- Encoding types (Auto, ASCII, ASCIINumeric, Base256)
- Square and rectangular formats
- Compact size for small labels
Documentation and Navigation Guide
Getting Started
📄 Read: references/getting-started.md
- Installation and package setup
- Add dependency to pubspec.yaml
- Import barcode package
- Basic SfBarcodeGenerator implementation
- Create your first 1D barcode (Code128)
- Create your first QR code
- Display input value below barcode
- Next steps and learning path
Barcode Types and Symbologies
📄 Read: references/barcode-types.md
- All 12 one-dimensional barcode types with examples
- All 2 two-dimensional barcode types with examples
- Detailed properties for each symbology
- Input validation rules per barcode type
- Character support and limitations
- Choosing the right barcode type for your use case
- Symbology comparison table
- Best practices for barcode selection
Customization and Styling
📄 Read: references/customization.md
- Text customization (showValue, textStyle, textSpacing, textAlign)
- Bar customization (module, barColor, backgroundColor)
- Size and layout control
- Responsive sizing strategies
- Text style properties (font, size, weight, color)
- Bar width (module) configuration for 1D and 2D barcodes
- Complete customization examples
- Best practices for scannable barcodes
Accessibility Features
📄 Read: references/accessibility.md
- Sufficient contrast support
- Large fonts and text scaling
- Color customization for accessibility
- MediaQueryData integration
- Accessibility best practices
- Testing for readability
Quick Start Examples
Basic QR Code
import 'package:flutter/material.dart';
import 'package:syncfusion_flutter_barcodes/barcodes.dart';
class QRCodeExample extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text('QR Code')),
body: Center(
child: Container(
height: 300,
width: 300,
child: SfBarcodeGenerator(
value: 'https://www.syncfusion.com',
symbology: QRCode(),
showValue: true,
),
),
),
);
}
}
Basic Code128 Barcode
import 'package:flutter/material.dart';
import 'package:syncfusion_flutter_barcodes/barcodes.dart';
class Code128Example extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text('Code128 Barcode')),
body: Center(
child: Container(
height: 150,
child: SfBarcodeGenerator(
value: 'SYNCFUSION',
symbology: Code128(),
showValue: true,
),
),
),
);
}
}
Retail Product Barcode (EAN13)
import 'package:flutter/material.dart';
import 'package:syncfusion_flutter_barcodes/barcodes.dart';
class RetailBarcodeExample extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text('Product Barcode')),
body: Center(
child: Container(
height: 150,
width: 280,
child: SfBarcodeGenerator(
value: '9735940564824',
symbology: EAN13(),
showValue: true,
),
),
),
);
}
}
Common Patterns
Pattern 1: QR Code with Error Correction
SfBarcodeGenerator(
value: 'https://www.example.com/product/12345',
symbology: QRCode(
errorCorrectionLevel: ErrorCorrectionLevel.high,
codeVersion: QRCodeVersion.auto,
inputMode: QRInputMode.binary,
),
showValue: true,
textSpacing: 10,
)
Pattern 2: Customized Barcode Appearance
SfBarcodeGenerator(
value: 'PRODUCT-12345',
symbology: Code128(module: 2),
barColor: Colors.deepPurple,
backgroundColor: Colors.grey[100],
textStyle: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
color: Colors.deepPurple,
),
showValue: true,
textAlign: TextAlign.center,
textSpacing: 15,
)
Pattern 3: Multiple Barcode Types in List
class BarcodeList extends StatelessWidget {
final List<BarcodeItem> barcodeTypes = [
BarcodeItem('Code128', '12345678', Code128()),
BarcodeItem('QR Code', 'https://example.com', QRCode()),
BarcodeItem('EAN13', '9735940564824', EAN13()),
BarcodeItem('Code39', 'CODE39', Code39()),
];
@override
Widget build(BuildContext context) {
return ListView.builder(
itemCount: barcodeTypes.length,
itemBuilder: (context, index) {
final item = barcodeTypes[index];
return Card(
margin: EdgeInsets.all(8),
child: Padding(
padding: EdgeInsets.all(16),
child: Column(
children: [
Text(
item.name,
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
),
SizedBox(height: 10),
Container(
height: 150,
child: SfBarcodeGenerator(
value: item.value,
symbology: item.symbology,
showValue: true,
),
),
],
),
),
);
},
);
}
}
class BarcodeItem {
final String name;
final String value;
final Symbology symbology;
BarcodeItem(this.name, this.value, this.symbology);
}
Pattern 4: Responsive Barcode Sizing
class ResponsiveBarcode extends StatelessWidget {
@override
Widget build(BuildContext context) {
final screenWidth = MediaQuery.of(context).size.width;
final barcodeSize = screenWidth * 0.8;
return Center(
child: Container(
height: barcodeSize,
width: barcodeSize,
child: SfBarcodeGenerator(
value: 'RESPONSIVE-BARCODE',
symbology: QRCode(),
showValue: true,
),
),
);
}
}
Key Properties
SfBarcodeGenerator Essential Properties
| Property |
Type |
Description |
Default |
| value |
String |
The data to encode in the barcode |
Required |
| symbology |
Symbology |
Barcode type (Code128, QRCode, etc.) |
Code128 |
| showValue |
bool |
Display input value below barcode |
false |
| barColor |
Color |
Color of barcode bars/modules |
Colors.black |
| backgroundColor |
Color |
Background color of barcode |
Colors.white |
| textStyle |
TextStyle |
Style for displayed text |
Default TextStyle |
| textSpacing |
double |
Space between barcode and text |
2 |
| textAlign |
TextAlign |
Horizontal alignment of text |
TextAlign.center |
Common Symbology Properties
| Property |
Applies To |
Description |
Default |
| module |
All types |
Width of smallest bar/dot (logical pixels) |
Auto-calculated |
Code39 Specific Properties
| Property |
Type |
Description |
Default |
| enableCheckSum |
bool |
Add check digit to barcode |
true |
QR Code Specific Properties
| Property |
Type |
Description |
Default |
| errorCorrectionLevel |
ErrorCorrectionLevel |
Error recovery level (low, medium, quartile, high) |
high |
| codeVersion |
QRCodeVersion |
QR version 1-40 or auto |
auto |
| inputMode |
QRInputMode |
Input type (numeric, alphanumeric, binary, kanji) |
binary |
Data Matrix Specific Properties
| Property |
Type |
Description |
Default |
| encoding |
DataMatrixEncoding |
Encoding type (auto, ASCII, ASCIINumeric, base256) |
auto |
| dataMatrixSize |
DataMatrixSize |
Size configuration |
auto |
Common Use Cases
- Product Labeling - Generate EAN13 or UPCA barcodes for retail products
- Inventory Management - Use Code128 for tracking assets and stock items
- QR Code Marketing - Create QR codes for URLs, promotions, and campaigns
- Ticket Generation - Generate unique barcodes for event tickets and vouchers
- Document Identification - Add Code39 or Code128 to documents for tracking
- Payment QR Codes - Create QR codes for payment gateways and transactions
- Asset Tracking - Label equipment and assets with Codabar or Code128
- Shipping Labels - Use Code128 for package tracking and logistics
- Library Management - Implement Codabar for book and media tracking
- Healthcare Labels - Generate barcodes for patient records and medications
- Contact Sharing - Create QR codes with vCard data for business cards
- Wi-Fi Sharing - Generate QR codes for Wi-Fi credentials
Related Resources
1---2name: syncfusion-flutter-barcode-generator3description: Implements Syncfusion Flutter Barcode Generator (SfBarcodeGenerator) for generating 1D and 2D barcodes in Flutter apps. Use when working with QR codes, Data Matrix, Code128, EAN, UPC, or other machine-readable barcode formats. This skill covers barcode types, customization, sizing, text display, and integration into product labels, ticketing, or inventory systems.4---56# Syncfusion Flutter Barcode Generator78This skill covers the Syncfusion Flutter Barcode Generator component (**SfBarcodeGenerator**) for creating machine-readable barcodes. The widget supports 14 different barcode symbologies including popular 1D barcodes (Code128, EAN, UPC, etc.) and 2D barcodes (QR Code, Data Matrix).910## When to Use This Skill1112Use this skill when you need to:1314- **Generate barcodes** for products, assets, or documents15- **Implement QR codes** for URLs, contact info, or payments16- **Create product labels** with retail barcodes (EAN, UPC)17- **Build inventory systems** with barcode tracking18- **Generate Data Matrix codes** for compact data encoding19- **Add barcode scanning integration** to your Flutter apps20- **Create tickets or vouchers** with unique barcode identifiers21- **Implement asset tracking** with barcode labels22- **Generate barcodes for documents** or identification cards23- **Customize barcode appearance** with colors, text, and styling24- **Support multiple barcode formats** in a single application25- **Display machine-readable codes** for data input workflows2627## Component Overview2829**SfBarcodeGenerator** is a data visualization widget designed to generate and display data in a machine-readable format. It provides:3031- **14 Barcode Symbologies** - 12 one-dimensional and 2 two-dimensional types32- **Customizable Appearance** - Colors, text styling, spacing, and bar width control33- **Easy Integration** - Simple API with minimal configuration34- **Accessibility Support** - Sufficient contrast and large fonts support35- **Flexible Sizing** - Automatic or manual module (bar width) configuration36- **Text Display** - Show/hide input values with custom formatting3738## Supported Barcode Types3940### One-Dimensional (1D) Barcodes - 12 Types4142| Barcode Type | Character Support | Typical Use Cases |43|--------------|------------------|-------------------|44| **Codabar** | Numeric + special chars (-, :, /, +) | Libraries, blood banks, shipping |45| **Code39** | Alphanumeric (uppercase) + symbols | Automotive, defense, healthcare |46| **Code39Extended** | Full ASCII (all 128 characters) | Extended character encoding |47| **Code93** | Alphanumeric + symbols | Compact encoding, logistics |48| **Code128** | Full ASCII (automatic mode) | Most versatile, shipping, packaging |49| **Code128A** | ASCII 0-95 (uppercase + control) | Control character encoding |50| **Code128B** | ASCII 32-127 (upper + lowercase) | Standard text encoding |51| **Code128C** | Numeric pairs (00-99) | Numeric data, double density |52| **UPCA** | 12-digit numeric | Retail products (North America) |53| **UPCE** | 8-digit numeric (compact) | Small package retail products |54| **EAN13** | 13-digit numeric | International retail products |55| **EAN8** | 8-digit numeric | Small retail products |5657### Two-Dimensional (2D) Barcodes - 2 Types5859| Barcode Type | Data Capacity | Typical Use Cases |60|--------------|---------------|-------------------|61| **QR Code** | Up to 7,089 numeric or 4,296 alphanumeric | URLs, contact info, payments, marketing |62| **Data Matrix** | Up to 3,116 numeric or 2,335 alphanumeric | Electronics, pharmaceuticals, printed media |6364**QR Code Features:**65- Error correction levels (Low, Medium, Quartile, High)66- Input modes (Numeric, Alphanumeric, Binary, Kanji)67- Version 1-40 (21x21 to 177x177 modules)6869**Data Matrix Features:**70- Encoding types (Auto, ASCII, ASCIINumeric, Base256)71- Square and rectangular formats72- Compact size for small labels7374## Documentation and Navigation Guide7576### Getting Started7778📄 **Read:** [references/getting-started.md](references/getting-started.md)79- Installation and package setup80- Add dependency to pubspec.yaml81- Import barcode package82- Basic SfBarcodeGenerator implementation83- Create your first 1D barcode (Code128)84- Create your first QR code85- Display input value below barcode86- Next steps and learning path8788### Barcode Types and Symbologies8990📄 **Read:** [references/barcode-types.md](references/barcode-types.md)91- All 12 one-dimensional barcode types with examples92- All 2 two-dimensional barcode types with examples93- Detailed properties for each symbology94- Input validation rules per barcode type95- Character support and limitations96- Choosing the right barcode type for your use case97- Symbology comparison table98- Best practices for barcode selection99100### Customization and Styling101102📄 **Read:** [references/customization.md](references/customization.md)103- Text customization (showValue, textStyle, textSpacing, textAlign)104- Bar customization (module, barColor, backgroundColor)105- Size and layout control106- Responsive sizing strategies107- Text style properties (font, size, weight, color)108- Bar width (module) configuration for 1D and 2D barcodes109- Complete customization examples110- Best practices for scannable barcodes111112### Accessibility Features113114📄 **Read:** [references/accessibility.md](references/accessibility.md)115- Sufficient contrast support116- Large fonts and text scaling117- Color customization for accessibility118- MediaQueryData integration119- Accessibility best practices120- Testing for readability121122## Quick Start Examples123124### Basic QR Code125126```dart127import 'package:flutter/material.dart';128import 'package:syncfusion_flutter_barcodes/barcodes.dart';129130class QRCodeExample extends StatelessWidget {131 @override132 Widget build(BuildContext context) {133 return Scaffold(134 appBar: AppBar(title: Text('QR Code')),135 body: Center(136 child: Container(137 height: 300,138 width: 300,139 child: SfBarcodeGenerator(140 value: 'https://www.syncfusion.com',141 symbology: QRCode(),142 showValue: true,143 ),144 ),145 ),146 );147 }148}149```150151### Basic Code128 Barcode152153```dart154import 'package:flutter/material.dart';155import 'package:syncfusion_flutter_barcodes/barcodes.dart';156157class Code128Example extends StatelessWidget {158 @override159 Widget build(BuildContext context) {160 return Scaffold(161 appBar: AppBar(title: Text('Code128 Barcode')),162 body: Center(163 child: Container(164 height: 150,165 child: SfBarcodeGenerator(166 value: 'SYNCFUSION',167 symbology: Code128(),168 showValue: true,169 ),170 ),171 ),172 );173 }174}175```176177### Retail Product Barcode (EAN13)178179```dart180import 'package:flutter/material.dart';181import 'package:syncfusion_flutter_barcodes/barcodes.dart';182183class RetailBarcodeExample extends StatelessWidget {184 @override185 Widget build(BuildContext context) {186 return Scaffold(187 appBar: AppBar(title: Text('Product Barcode')),188 body: Center(189 child: Container(190 height: 150,191 width: 280,192 child: SfBarcodeGenerator(193 value: '9735940564824',194 symbology: EAN13(),195 showValue: true,196 ),197 ),198 ),199 );200 }201}202```203204## Common Patterns205206### Pattern 1: QR Code with Error Correction207208```dart209SfBarcodeGenerator(210 value: 'https://www.example.com/product/12345',211 symbology: QRCode(212 errorCorrectionLevel: ErrorCorrectionLevel.high,213 codeVersion: QRCodeVersion.auto,214 inputMode: QRInputMode.binary,215 ),216 showValue: true,217 textSpacing: 10,218)219```220221### Pattern 2: Customized Barcode Appearance222223```dart224SfBarcodeGenerator(225 value: 'PRODUCT-12345',226 symbology: Code128(module: 2),227 barColor: Colors.deepPurple,228 backgroundColor: Colors.grey[100],229 textStyle: TextStyle(230 fontSize: 16,231 fontWeight: FontWeight.bold,232 color: Colors.deepPurple,233 ),234 showValue: true,235 textAlign: TextAlign.center,236 textSpacing: 15,237)238```239240### Pattern 3: Multiple Barcode Types in List241242```dart243class BarcodeList extends StatelessWidget {244 final List<BarcodeItem> barcodeTypes = [245 BarcodeItem('Code128', '12345678', Code128()),246 BarcodeItem('QR Code', 'https://example.com', QRCode()),247 BarcodeItem('EAN13', '9735940564824', EAN13()),248 BarcodeItem('Code39', 'CODE39', Code39()),249 ];250251 @override252 Widget build(BuildContext context) {253 return ListView.builder(254 itemCount: barcodeTypes.length,255 itemBuilder: (context, index) {256 final item = barcodeTypes[index];257 return Card(258 margin: EdgeInsets.all(8),259 child: Padding(260 padding: EdgeInsets.all(16),261 child: Column(262 children: [263 Text(264 item.name,265 style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),266 ),267 SizedBox(height: 10),268 Container(269 height: 150,270 child: SfBarcodeGenerator(271 value: item.value,272 symbology: item.symbology,273 showValue: true,274 ),275 ),276 ],277 ),278 ),279 );280 },281 );282 }283}284285class BarcodeItem {286 final String name;287 final String value;288 final Symbology symbology;289 290 BarcodeItem(this.name, this.value, this.symbology);291}292```293294### Pattern 4: Responsive Barcode Sizing295296```dart297class ResponsiveBarcode extends StatelessWidget {298 @override299 Widget build(BuildContext context) {300 final screenWidth = MediaQuery.of(context).size.width;301 final barcodeSize = screenWidth * 0.8;302303 return Center(304 child: Container(305 height: barcodeSize,306 width: barcodeSize,307 child: SfBarcodeGenerator(308 value: 'RESPONSIVE-BARCODE',309 symbology: QRCode(),310 showValue: true,311 ),312 ),313 );314 }315}316```317318## Key Properties319320### SfBarcodeGenerator Essential Properties321322| Property | Type | Description | Default |323|----------|------|-------------|---------|324| **value** | String | The data to encode in the barcode | Required |325| **symbology** | Symbology | Barcode type (Code128, QRCode, etc.) | Code128 |326| **showValue** | bool | Display input value below barcode | false |327| **barColor** | Color | Color of barcode bars/modules | Colors.black |328| **backgroundColor** | Color | Background color of barcode | Colors.white |329| **textStyle** | TextStyle | Style for displayed text | Default TextStyle |330| **textSpacing** | double | Space between barcode and text | 2 |331| **textAlign** | TextAlign | Horizontal alignment of text | TextAlign.center |332333### Common Symbology Properties334335| Property | Applies To | Description | Default |336|----------|-----------|-------------|---------|337| **module** | All types | Width of smallest bar/dot (logical pixels) | Auto-calculated |338339### Code39 Specific Properties340341| Property | Type | Description | Default |342|----------|------|-------------|---------|343| **enableCheckSum** | bool | Add check digit to barcode | true |344345### QR Code Specific Properties346347| Property | Type | Description | Default |348|----------|------|-------------|---------|349| **errorCorrectionLevel** | ErrorCorrectionLevel | Error recovery level (low, medium, quartile, high) | high |350| **codeVersion** | QRCodeVersion | QR version 1-40 or auto | auto |351| **inputMode** | QRInputMode | Input type (numeric, alphanumeric, binary, kanji) | binary |352353### Data Matrix Specific Properties354355| Property | Type | Description | Default |356|----------|------|-------------|---------|357| **encoding** | DataMatrixEncoding | Encoding type (auto, ASCII, ASCIINumeric, base256) | auto |358| **dataMatrixSize** | DataMatrixSize | Size configuration | auto |359360## Common Use Cases3613621. **Product Labeling** - Generate EAN13 or UPCA barcodes for retail products3632. **Inventory Management** - Use Code128 for tracking assets and stock items3643. **QR Code Marketing** - Create QR codes for URLs, promotions, and campaigns3654. **Ticket Generation** - Generate unique barcodes for event tickets and vouchers3665. **Document Identification** - Add Code39 or Code128 to documents for tracking3676. **Payment QR Codes** - Create QR codes for payment gateways and transactions3687. **Asset Tracking** - Label equipment and assets with Codabar or Code1283698. **Shipping Labels** - Use Code128 for package tracking and logistics3709. **Library Management** - Implement Codabar for book and media tracking37110. **Healthcare Labels** - Generate barcodes for patient records and medications37211. **Contact Sharing** - Create QR codes with vCard data for business cards37312. **Wi-Fi Sharing** - Generate QR codes for Wi-Fi credentials374375## Related Resources376377- **Package:** [syncfusion_flutter_barcodes](https://pub.dev/packages/syncfusion_flutter_barcodes)378- **API Documentation:** [SfBarcodeGenerator API](https://pub.dev/documentation/syncfusion_flutter_barcodes/latest/barcodes/SfBarcodeGenerator-class.html)379- **GitHub Examples:** [Flutter Barcode Examples](https://github.com/syncfusion/flutter-examples)380- **Video Tutorial:** [Getting Started with Flutter Barcode Generator](https://www.youtube.com/watch?v=ckAHrT2CR8A)381- **Official Documentation:** [Syncfusion Flutter Barcode User Guide](https://help.syncfusion.com/flutter/barcode/overview)