Skip to content
pubscout

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.

WASM-ready
$ flutter pub add fhir_r4
Source repository

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

Works with

Packages commonly used together with fhir_r4: ones it builds on, ones built on it, and its own family.