ini_file 1.0.0 copy "ini_file: ^1.0.0" to clipboard
ini_file: ^1.0.0 copied to clipboard

get, set, create, delete sections, keys, values from ini file, without loosing its format, blank lines, comments, etc.

example/ini_file_example.dart

import 'package:ini_file/ini_file.dart';

void main() async {
  // create instance and eliminate spaces from results
  // key = abc will return:
  // trimResults = true ?  'abc'
  // trimResults = false ? ' abc'
  IniFile ini = IniFile(trimResults: true);

  await ini.readFile('./example/YSA.ini');

  print(ini.toMap());

  print(ini.getItems('SETTINGS'));
  print(ini.getJsonItems('SETTINGS'));

  ini.setItem('SETTINGS', 'caps', '2');
  print(ini.getItem('SETTINGS', 'caps'));

  ini.setItem('SETTINGS', 'debug', 'false');
  print(ini.getItem('SETTINGS', 'debug'));

  ini.setItems('SETTINGS', [
    ['abc', '1'],
    ['def', '2']
  ]);
  print(ini.getItems('SETTINGS'));

  ini.removeSection('SETTINGS');
  ini.setItem('NEWSECTION', 'newitem', 'new value');
  print(ini.getItems('NEWSECTION'));

  ini = IniFile.emptyFile('./example/new.ini', overrideFile: true);
  ini.setItem('section', 'key', 'value');
  ini.writeFile();
  print(ini.getItem('section', 'key'));
}
3
likes
150
pub points
70%
popularity

Publisher

unverified uploader

get, set, create, delete sections, keys, values from ini file, without loosing its format, blank lines, comments, etc.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

More

Packages that depend on ini_file