dart_range 1.0.0

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • 26

dart_range

Simple range iterator.

Basic Usage

range() method creates a Range object as follows:

range(1, 5);    // [1, 2, 3, 4]
range(1, 8, 2); // [1, 3, 5, 7]

Range class implements Iterable, so you can easily iterate over it:

range(0, 3).forEach((e) => print(e)); // 0, 1, 2

For creating detailed ranges, you have:

inclusiveRange(begin, end, [step]);  // [begin, end]
exclusiveRange(begin, end, [step]);  // (begin, end)
openClosedRange(begin, end, [step]); // (begin, end]
closedOpenRange(begin, end, [step]); // [begin, end)

You can also create a infinite range:

inifiniteRange(begin, [step]);      // [begin, infinity)
openInfiniteRange(begin, [step]);   // (begin, infinity)
closedInfiniteRange(begin, [step]); // same as infiniteRange 

If you need a type-specific range, please use:

range<int>(begin, end);
inclusiveRange<int>(begin, end);
range<double>(begin, end);
inclusiveRange<double>(begin, end);
// and so on

Changelog

1.0.0

  • range methods now returns Range object instead of Iterable.
  • Support generic methods.
  • Remove non-generic methods.

0.0.1

  • Initial version.

Use this package as a library

1. Depend on it

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


dependencies:
  dart_range: ^1.0.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:dart_range/dart_range.dart';
  
Version Uploaded Documentation Archive
1.0.1 Nov 10, 2017 Go to the documentation of dart_range 1.0.1 Download dart_range 1.0.1 archive
1.0.0 Nov 10, 2017 Go to the documentation of dart_range 1.0.0 Download dart_range 1.0.0 archive
0.0.1 Feb 4, 2015 Go to the documentation of dart_range 0.0.1 Download dart_range 0.0.1 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
52
Health:
Code health derived from static analysis. [more]
0
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
0
Overall:
Weighted score of the above. [more]
26
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.

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.

Dependencies

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