Skip to content
pubscout

properties

2.1.1, released 2 years ago by intinio.com

A simple library to read, write, and manipulate Java-style properties files in Dart.

$ flutter pub add properties
Source repository

What it does

The properties package enables parsing and managing key-value configuration files. It supports typed getters for primitives and lists, default fallbacks, and event streams for property modifications. It also provides methods to filter entries, export to JSON, and save changes back to files.

AI-written summary of version 2.1.1, based on the package's README and metadata. Report an inaccuracy

Use it when

  • Reading or writing Java-style .properties configuration files in Dart applications.
  • Accessing configuration key-values with automatic parsing to types like int, double, bool, or List.
  • Listening to changes when properties are added or updated in a configuration store.

Skip it when

  • Managing structured or hierarchical configuration formats such as JSON, YAML, or TOML.
  • Web-only Flutter apps where direct file-based properties operations are not applicable.

Strengths

  • Provides typed accessor methods (getInt, getDouble, getBool, getList) with fallback support.
  • Includes event streams (e.g., onAdd) to react to property changes.
  • Supports JSON serialization and filtering via custom predicates.

Weaknesses

  • Outdated README notes stating file output is unsupported, contradicting changelog additions like saveToFile.
  • Limited formatting and comment-preservation capabilities compared to modern config parsers.

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
1

None

Properties p = Properties.fromFile('config.properties');
String? val = p.get('test.key', defval: 'default');
int count = p.getInt('test.count');
p.add('new.key', 'new value', true);
p.saveToFile('config.properties');

Alternatives

Packages that do the same job and could replace properties.

  • cli_config

    Pick cli_config when dealing with standard Dart CLI configurations and environment variable overrides.

Works with

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