danfe
3.1.1, released 4 days ago by marcus.brasizza.com
Parse DANFE and National NFSe XML documents into objects, Flutter widgets, or ESC/POS printer buffers.
WASM-ready
What it does
Parses Brazilian electronic fiscal documents (DANFE for NF-e/NFC-e and National NFSe) from XML strings into structured Dart objects. It converts these documents into Flutter widgets, images, or ESC/POS printer command buffers for thermal printing.
AI-written summary of version 3.1.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to parse NF-e, NFC-e, or National NFSe XML files in a Flutter application.
- You want to render electronic fiscal documents directly onto thermal ESC/POS printers via network, buffer, or image conversion.
- You need to transform fiscal XML data into Flutter widgets or images for display.
Skip it when
- You need to parse legacy SAT (CFe) documents, which are no longer supported.
- You are working with non-Brazilian fiscal documents or other custom XML formats.
Strengths
- Supports modern tax reform updates like IBS, CBS, and Imposto Seletivo (NT 2025.002).
- Provides multi-format output including raw buffers, widgets, and images.
- Easily extensible through custom parsers and layouts.
Weaknesses
- Limited to Brazilian fiscal documents (DANFE and National NFSe).
- SAT CFe support was completely removed in version 3.0.0.
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 5
No native platform permissions or complex configuration required.
import 'package:danfe/danfe.dart';
Danfe? danfe = DanfeParser.readFromString(xml);Works with
Packages commonly used together with danfe: ones it builds on, ones built on it, and its own family.
- intldanfe depends on itA Dart library for internationalization and localization, providing message translation, plural/gender handling, and date/number formatting.
- imagedanfe depends on itPure Dart library to load, manipulate, encode, and decode various image formats.
- esc_pos_utils_plusdanfe depends on itGenerate ESC/POS commands for thermal receipt printers.