dart_range 1.0.0

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • 43

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

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: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

Analysis

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

  • Dart: 2.0.0-dev.63.0
  • pana: 0.11.3

Scores

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

Platforms

Detected platforms: Flutter, web, other

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

Suggestions

  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 1 error 3 hints.

    Strong-mode analysis of lib/dart_range.dart failed with the following error:

    line: 149 col: 14
    The argument type 'String' can't be assigned to the parameter type 'T'.

  • The description is too short.

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

  • Maintain an example.

    Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use dart_range.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.21.0 <2.0.0
Dev dependencies
test ^0.12.27+1