dart_range 1.0.1

  • Readme
  • Changelog
  • Installing
  • 0

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.1 #

  • Enable Dart strong mode.

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:

  dart_range: ^1.0.1

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';
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.

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://dart.dev/dart-2#migration.

Maintenance issues and suggestions

Make sure dartdoc successfully runs on your package's source files. (-10 points)

Dependencies were not resolved.


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