grizzly_range 2.0.9

  • Readme
  • Changelog
  • Example
  • Installing
  • 65

Range #

Lazy and efficient 'range' iterables to generate values based on start, stop and step/count.

Int ranges #

print(IntRange(0, 5));

Ranges can also be descending:

print(IntRange(5, -5));

Until #

IntRange.until returns an Iterable<int> with range [0, stop] with provided step.

print(IntRange.until(50, 10));

Linspace #

IntRange.linspace returns an Iterable<int> with range [start, stop] with [count] elements in it.

print(IntRange.linspace(1, 10, 5));

Note: For other types of ranges, please refer sections below.

Extent #

print(Extent.compute<int>(List<int>.generate(10, (i) => i * 10)..shuffle()));

Ranging an Extent #

print(Extent(5, 50).range(5));

TODO DoubleRange

TODO TimeRange

TODO MonthRange

TODO others

2.0.9 #

  • Deprecated Extent.consecutive. Use Extent.edgesToBins instead

2.0.8 #

  • Extent is not Comparable
  • Added Extent.linspace
  • Dart analyzer improvements

2.0.6 #

  • Fixed ticks

2.0.5 #

  • Added Extent.consecutive constructor

2.0.4 #

  • Moved Extent to grizzly_range package from grizzly_primitives package

2.0.2 #

  • README

2.0.1 #

  • Moved range functions from grizzly_primitive package

example/example.dart

import 'package:grizzly_range/grizzly_range.dart';

void main() {
  print(IntRange(0, 5));
  print(IntRange(5, -5));
  print(IntRange.until(5, 2));
  print(IntRange.linspace(1, 10, 5));
  print(IntRange.linspace(10, -8, 5));

  for (final i in IntRange(0, 5)) {
    print(i);
  }

  print(IntRange(0, 5).length);
  print(IntRange(5, -5).length);
  print(IntRange.until(5, 2).length);
  print(IntRange.linspace(1, 10, 5).length);
  print(IntRange.linspace(10, -8, 5).length);
}

Use this package as a library

1. Depend on it

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


dependencies:
  grizzly_range: ^2.0.9

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

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

3. Import it

Now in your Dart code, you can use:


import 'package:grizzly_range/grizzly_range.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
31
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
65
Learn more about scoring.

We analyzed this package on Jul 10, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.14

Health suggestions

Fix lib/src/range/range.dart. (-0.50 points)

Analysis of lib/src/range/range.dart reported 1 hint:

line 3 col 8: Unused import: 'dart:math'.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.5.0 <3.0.0
collection ^1.14.12 1.14.13 1.15.0-nullsafety
meta ^1.1.7 1.2.2 1.3.0-nullsafety
quiver_hashcode ^2.0.0 2.0.0
Dev dependencies
pedantic ^1.8.0
test ^1.6.0