ini 2.0.1

  • Example
  • Installing
  • Versions
  • 77

Dart INI

This library deals with reading and writing ini files. This implements the standard as defined here:

The ini file reader will return data organized by section and option. The default section will be the blank string.


Read a file:

import "package:ini/ini.dart";

new File("config.ini").readAsLines()
    .then((lines) => new Config.fromStrings(lines))
    .then((Config config) => ...);

Write a file:

new File("config.ini").writeAsString(config.toString());

Read options:

// List all sections in the configuration, excluding default.

// List options within a section

// List of key value pairs for a section.

// Read specific options.
config.get("section", "option");
config.hasOption("section", "option");

Write options:

// Make sure you add sections before using them.

config.set("section", "option", "value");


config.removeOption("section", "option");

There is example code in the example/ directory.


import 'package:ini/ini.dart';
import 'dart:io';

File file = new File("example/config.ini");

void doConfigThings(Config config, String label) {
  print("${label}: loaded config from ${file.path}");

  print("${label}: Read some values...");
  print("${label}: ${config.hasOption('default', 'default')}");
  print("${label}: ${config.defaults()["default"]}");
  print("${label}: ${config.get("section", "section")}");

  print("${label}: Write some values...");
  config.set("new", "entry", "result");
  print("${label}: Added a new section and entry");

  print("${label}: Write out config (to screen)");
  print("${label}: ${config.toString()}");

void main() {
      .then((lines) => new Config.fromStrings(lines))
      .then((Config config) {
    doConfigThings(config, "async");

  Config config = new Config.fromStrings(file.readAsLinesSync());
  doConfigThings(config, "sync");

// vim: set ai et sw=2 syntax=dart :

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  ini: ^2.0.1

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter packages get

Alternatively, your editor might support pub get or flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:ini/ini.dart';
Version Uploaded Documentation Archive
2.0.1 Oct 9, 2018 Go to the documentation of ini 2.0.1 Download ini 2.0.1 archive
2.0.0 Oct 7, 2018 Go to the documentation of ini 2.0.0 Download ini 2.0.0 archive
1.1.0 Mar 24, 2015 Go to the documentation of ini 1.1.0 Download ini 1.1.0 archive
1.0.1 Feb 19, 2015 Go to the documentation of ini 1.0.1 Download ini 1.0.1 archive
1.0.0 Sep 7, 2014 Go to the documentation of ini 1.0.0 Download ini 1.0.0 archive
0.0.6 Sep 8, 2013 Go to the documentation of ini 0.0.6 Download ini 0.0.6 archive
0.0.5 Sep 1, 2013 Go to the documentation of ini 0.0.5 Download ini 0.0.5 archive
0.0.4 Aug 20, 2013 Go to the documentation of ini 0.0.4 Download ini 0.0.4 archive
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Dec 5, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.1.0
  • pana: 0.12.7


Detected platforms: Flutter, web, other

No platform restriction found in primary library package:ini/ini.dart.

Maintenance issues and suggestions

Maintain (-20 points)

Changelog entries help clients to follow the progress in your code.

The description is too short. (-20 points)

Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
Dev dependencies
stream_channel any
test any