options_file 0.11.0

  • README.md
  • Example
  • Installing
  • Versions
  • 24

options_file

Dart library for reading options files

OptionsFile reads options from a file. The options must be stored in name=value pairs, one pair per line. E.g.:

# stuff
name=James
age=9
height=256

Spaces around the key and value are trimmed. Any line which starts with a hash (#) is ignored. Any line which does not contain an equals sign is ignored.

Usage

OptionsFile options = new OptionsFile('example/local.options', 'example/default.options');

String user = options.getString('user', 'bob');
int port = options.getInt('port', 1234);

For further information on using optionsfile, see the dartdoc in options.dart, and the example files.

example/main.dart

import 'package:options_file/options_file.dart';

void main() {
  OptionsFile options = new OptionsFile('example/local.options', 'example/default.options');
  
  // these values are read from default.options, as they aren't in local.options
  String user = options.getString('user', 'bob');
  String type = options.getString('type', 'advanced');

  // these values are read from local.options
  int port = options.getInt('port', 1234);
  String host = options.getString('host', 'www.dartlang.org');
  
  // this value isn't in either file, so the default here is used
  String parity = options.getString('parity', 'even');
  
  print("user=$user");
  print("type=$type");
  print("port=$port");
  print("host=$host");
  print("parity=$parity");
}

Use this package as a library

1. Depend on it

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


dependencies:
  options_file: ^0.11.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

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

3. Import it

Now in your Dart code, you can use:


import 'package:options_file/options_file.dart';
  
Version Uploaded Documentation Archive
0.11.0 Aug 6, 2015 Go to the documentation of options_file 0.11.0 Download options_file 0.11.0 archive
0.10.0 Nov 11, 2013 Go to the documentation of options_file 0.10.0 Download options_file 0.10.0 archive
0.9.15 Nov 5, 2013 Go to the documentation of options_file 0.9.15 Download options_file 0.9.15 archive
0.9.14 Jul 31, 2013 Go to the documentation of options_file 0.9.14 Download options_file 0.9.14 archive
0.9.13 Jun 20, 2013 Go to the documentation of options_file 0.9.13 Download options_file 0.9.13 archive
0.9.12 May 17, 2013 Go to the documentation of options_file 0.9.12 Download options_file 0.9.12 archive
0.9.11 Mar 6, 2013 Go to the documentation of options_file 0.9.11 Download options_file 0.9.11 archive
0.9.10 Jan 28, 2013 Go to the documentation of options_file 0.9.10 Download options_file 0.9.10 archive
0.9.9 Jan 23, 2013 Go to the documentation of options_file 0.9.9 Download options_file 0.9.9 archive
0.9.8 Jan 22, 2013 Go to the documentation of options_file 0.9.8 Download options_file 0.9.8 archive

All 12 versions...

Popularity:
Describes how popular the package is relative to other packages. [more]
49
Health:
Code health derived from static analysis. [more]
--
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
--
Overall:
Weighted score of the above. [more]
24
Learn more about scoring.

The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.

Analysis issues and suggestions

Support Dart 2 in pubspec.yaml.

The SDK constraint in pubspec.yaml doesn't allow the Dart 2.0.0 release. For information about upgrading it to be Dart 2 compatible, please see https://www.dartlang.org/dart-2#migration.

Maintenance issues and suggestions

Running dartdoc failed. (-10 points)

Make sure dartdoc runs without any issues.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=0.11.0 <2.0.0