fhir_r4
0.14.1, released 11 days ago by fhirfli.dev
Strongly‑typed immutable FHIR R4B resource and data‑type models for Dart/Flutter with JSON/YAML/XML support.
What it does
The package provides Dart classes for every FHIR R4B resource and primitive type, generated from the official specification. It includes utilities for serialization, deserialization, validation and copy‑with immutability.
AI-written summary of version 0.14.1, based on the package's README and metadata. Report an inaccuracy
Use it when
- Building healthcare or interoperability apps that need to consume or produce FHIR R4B data
- You need type‑safe, immutable models with built‑in JSON/YAML/XML conversion
Skip it when
- Your app does not interact with FHIR or healthcare standards
- You need a minimal‑size library for simple data transfer
Strengths
- Full coverage of the FHIR R4B spec
- Strong typing and validation of all elements
- Immutable models with copyWith and deep equality
- Built‑in support for JSON, YAML and XML
Weaknesses
- Large API surface can increase app size
- Steep learning curve for developers unfamiliar with FHIR
- Limited to healthcare use‑cases
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 5
final patient = Patient(
id: FhirString('123'),
name: [HumanName(family: 'Doe'.toFhirString, given: ['John'.toFhirString])],
birthDate: '1990-01-01'.toFhirDate,
);
final json = patient.toJson();Alternatives
Packages that do the same job and could replace fhir_r4.
- json_annotation
Provides generic JSON serialization code‑gen for custom models, useful if you only need simple data classes without the full FHIR spec
84Compare
Works with
Packages commonly used together with fhir_r4: ones it builds on, ones built on it, and its own family.
- yamlfhir_r4 depends on itA Dart library for parsing YAML documents into Dart data structures.
- uuidfhir_r4 depends on itGenerates and parses RFC‑4122/9562 UUIDs (v1‑v8) for Dart.
- xmlfhir_r4 depends on itFull-featured XML and XPath library for DOM parsing, SAX streaming, and fluent building.
- fhirSame familyDart and Flutter library for working with FHIR resources across multiple versions.
- fhir_pathSame familyModel-independent FHIRPath evaluation engine in Dart, port of the Java reference implementation.