super_ranges 1.4.0

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • new60

Super Ranges #

pub package

Powerful yet intuitive Ranges for dart.

100% tests coverage.

Example #

import 'package:super_ranges/range.dart';

for (final value in Range(0,10)) {
  print(value);
}
Range(3,7).forEach(print); // 3 4 5 6
Range.closed(1,5).toList(); // [1,2,3,4,5]
Range.bySteps(1,5, stride: 2) // 1, 3, 5
Range.named(start: 1, end: 6, closed: true) // 1,2,3,4,5,6

Range.closed(4,10).contains(9.6) // true
Range(1,6) == Range.closed(1,5) // true
Range(1,6).toString() // (1..<6)

1.4.0 #

  • Added a couple constructors for Range: Rang.to + Range.toInclusive.

1.3.0+1 #

  • Added randomList + made randomElement a function so it can accept a couple of arguments.

1.2.0 #

  • Added randomElement + fixed lowerBound and upperBound.

1.1.0+1 #

  • Added sum, length property methods + refactor.

1.0.1 #

  • Removed flutter as a dependency, Range should work anywhere.

1.0.0 #

  • Initial release

example/main.dart

import 'package:super_ranges/super_ranges.dart';

void main() {
  for (final value in Range(0,10)) {
    print(value);
  }
  Range(3,7).forEach(print); // 3 4 5 6

  print( Range.closed(1,5).toList() ); // [1,2,3,4,5]
  print( Range.bySteps(1,5, stride: 2) ); // 1, 3, 5
  print( Range.named(start: 1, end: 6, closed: true)); // 1,2,3,4,5,6

  print( Range.closed(4,10).contains(9.6) ); // true
  print( Range(1,6) == Range.closed(1,5) ); // true
  print( Range(1,6).toString() ); // (1..<6)

  print(Range(5,0).toList());

  print(Range.closed(5,0).sum);

  print(Range.bySteps(3,3, stride: 3).sum);

  print(Range(6,2).lowerBound);
  print(Range(6,2).upperBound);
  print(Range(2,6).lowerBound);
  print(Range(2,6).upperBound);

  for (final i in Range.to(10)) {
    print(i);
  }

  for (final i in Range.toInclusive(10)) {
    print(i);
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  super_ranges: ^1.4.0

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support 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:super_ranges/super_ranges.dart';
  
Version Uploaded Documentation Archive
1.4.0 Jun 15, 2019 Go to the documentation of super_ranges 1.4.0 Download super_ranges 1.4.0 archive
1.3.0+1 Jun 14, 2019 Go to the documentation of super_ranges 1.3.0+1 Download super_ranges 1.3.0+1 archive
1.3.0 Jun 14, 2019 Go to the documentation of super_ranges 1.3.0 Download super_ranges 1.3.0 archive
1.2.0 Jun 13, 2019 Go to the documentation of super_ranges 1.2.0 Download super_ranges 1.2.0 archive
1.1.0+1 Jun 12, 2019 Go to the documentation of super_ranges 1.1.0+1 Download super_ranges 1.1.0+1 archive
1.1.0 Jun 12, 2019 Go to the documentation of super_ranges 1.1.0 Download super_ranges 1.1.0 archive
1.0.1 Jun 10, 2019 Go to the documentation of super_ranges 1.0.1 Download super_ranges 1.0.1 archive
1.0.0 Jun 10, 2019 Go to the documentation of super_ranges 1.0.0 Download super_ranges 1.0.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
21
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]
60
Learn more about scoring.

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

  • Dart: 2.3.2
  • pana: 0.12.18

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Format lib/base_range.dart.

Run flutter format to format lib/base_range.dart.

Format lib/range.dart.

Run flutter format to format lib/range.dart.

Format lib/stride_range.dart.

Run flutter format to format lib/stride_range.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
Dev dependencies
flutter_test