grizzly_primitives 2.0.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 45

grizzly_primitives #

Primitives (Range, Index, Pair, Extent) for Grizzly

Usage #

Range #

Pair #

  final p1 = pair<int, String>(1, 'one');
  print(p1.key);  // => 1
  print(p1.value);  // => one

IntPair #

  final p1 = intPair<String>(1, 'one');
  print(p1.key);  // => 1
  print(p1.value);  // => one

Index1D #

  final i1 = idx1D(5);
  print(i1.dim); // => 1
  print(i1.x); // => 5
  print(i1[0]); // => 5
  print(i1.toList()); // => [5]
  
  print(i1 == [5]); // => true
  print(i1 == [2]); // => false
  
  print(i1 > idx1D(2)); // => true
  print(i1 > idx1D(10)); // => false
  print(i1 >= idx1D(2)); // => true
  print(i1 >= idx1D(10)); // => false
  print(i1 >= idx1D(5)); // => true
  
  print(i1 < idx1D(2)); // => false
  print(i1 < idx1D(10)); // => true
  print(i1 <= idx1D(2)); // => false
  print(i1 <= idx1D(10)); // => true
  print(i1 <= idx1D(5)); // => true

Index2D #

  final i2 = idx2D(5, 25);
  print(i2.dim); // => 2
  print(i2.row); // => 5
  print(i2.col); // => 25
  print(i2[0]); // => 5
  print(i2[1]); // => 25
  print(i2.toList()); // => [5, 25]
  
  print(i2 == [5, 25]); // => true
  print(i2 == [5, 24]); // => false

  print(i2 > idx2D(0, 0)); // => true
  print(i2 > idx2D(10, 20)); // => false
  print(i2 >= idx2D(5, 5)); // => true
  print(i2 >= idx2D(4, 30)); // => false
  print(i2 >= idx2D(5, 25)); // => true

  print(i2 < idx2D(4, 30)); // => false
  print(i2 < idx2D(10, 30)); // => true
  print(i2 <= idx2D(10, 20)); // => false
  print(i2 <= idx2D(10, 30)); // => true
  print(i2 <= idx2D(5, 25)); // => true

Changelog #

2.0.1 #

  • Dart 2 support
  • Range improvements

0.2.5 #

  • Moved Ranger from grizzly_scales

0.2.3 #

  • Has breaking changes
  • Better arithmetic operator methods for Array2D

0.2.4 #

  • Several improvements to Array and Array2D

0.2.1 #

  • New API

0.1.0 #

  • New API

0.0.9 #

  • Removed uniqueSqueeze
  • Added sort to Array and Array2D

0.0.8 #

  • Added unique and uniqueSqueeze to Array and Array2D

0.0.7 #

  • Array and Array2D do not inherit from Iterable

0.0.5 #

  • Removed valueCounts from Array and Array2D

0.0.4 #

  • Array
  • Numeric1D
  • Array2D
  • Numeric2D

0.0.3 #

  • Series
  • DataFrameBase

0.0.2 #

  • Extent gets custom == operator

0.0.1 #

  • Pair
  • IntPair
  • Extent
  • Index1D
  • Index2D

example/grizzly_primitives_example.dart

import 'package:grizzly_primitives/grizzly_primitives.dart';

main() {
  final p1 = intPair<String>(1, 'one');
  print(p1.key); // => 1
  print(p1.value); // => one

  final Index1D i1 = idx1D(5);
  print(i1.dim); // => 1
  print(i1.x); // => 5
  print(i1[0]); // => 5
  print(i1.toList()); // => [5]

  print(i1 == [5]); // => true
  print(i1 == [2]); // => false

  print(i1 > idx1D(2)); // => true
  print(i1 > idx1D(10)); // => false
  print(i1 >= idx1D(2)); // => true
  print(i1 >= idx1D(10)); // => false
  print(i1 >= idx1D(5)); // => true

  print(i1 < idx1D(2)); // => false
  print(i1 < idx1D(10)); // => true
  print(i1 <= idx1D(2)); // => false
  print(i1 <= idx1D(10)); // => true
  print(i1 <= idx1D(5)); // => true

  final i2 = idx2D(5, 25);
  print(i2.dim); // => 2
  print(i2.row); // => 5
  print(i2.col); // => 25
  print(i2[0]); // => 5
  print(i2[1]); // => 25
  print(i2.toList()); // => [5, 25]

  print(i2 == [5, 25]); // => true
  print(i2 == [5, 24]); // => false

  print(i2 > idx2D(0, 0)); // => true
  print(i2 > idx2D(10, 20)); // => false
  print(i2 >= idx2D(5, 5)); // => true
  print(i2 >= idx2D(4, 30)); // => false
  print(i2 >= idx2D(5, 25)); // => true

  print(i2 < idx2D(4, 30)); // => false
  print(i2 < idx2D(10, 30)); // => true
  print(i2 <= idx2D(10, 20)); // => false
  print(i2 <= idx2D(10, 30)); // => true
  print(i2 <= idx2D(5, 25)); // => true
}

Use this package as a library

1. Depend on it

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


dependencies:
  grizzly_primitives: ^2.0.1

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_primitives/grizzly_primitives.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
13
Health:
Code health derived from static analysis. [more]
73
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
84
Overall:
Weighted score of the above. [more]
45
Learn more about scoring.

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

  • Dart: 2.5.1
  • pana: 0.12.21

Platforms

Detected platforms: Flutter, web, other

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

Health suggestions

Fix lib/src/dataframe/dataframe.dart. (-5.84 points)

Analysis of lib/src/dataframe/dataframe.dart reported 12 hints, including:

line 121 col 24: Use = to separate a named parameter from its default value.

line 122 col 19: Use = to separate a named parameter from its default value.

line 123 col 18: Use = to separate a named parameter from its default value.

line 124 col 17: Use = to separate a named parameter from its default value.

line 127 col 24: Use = to separate a named parameter from its default value.

Fix lib/src/ranger/ranger.dart. (-3.93 points)

Analysis of lib/src/ranger/ranger.dart reported 8 hints, including:

line 112 col 9: DO use curly braces for all flow control structures.

line 114 col 9: DO use curly braces for all flow control structures.

line 116 col 9: DO use curly braces for all flow control structures.

line 118 col 9: DO use curly braces for all flow control structures.

line 122 col 9: DO use curly braces for all flow control structures.

Fix lib/src/core/index.dart. (-3.45 points)

Analysis of lib/src/core/index.dart reported 7 hints, including:

line 98 col 20: 'checked' is deprecated and shouldn't be used.

line 106 col 21: 'checked' is deprecated and shouldn't be used.

line 114 col 21: 'checked' is deprecated and shouldn't be used.

line 187 col 20: 'checked' is deprecated and shouldn't be used.

line 194 col 20: 'checked' is deprecated and shouldn't be used.

Fix additional 9 files with analysis or formatting issues. (-17.34 points)

Additional issues in the following files:

  • lib/src/ranger/double_iterable.dart (7 hints)
  • lib/src/ranger/int_iterable.dart (7 hints)
  • lib/src/array/array.dart (5 hints)
  • lib/src/array/bool.dart (4 hints)
  • lib/src/series/series.dart (4 hints)
  • lib/src/array/numeric.dart (3 hints)
  • lib/src/series/view.dart (3 hints)
  • lib/src/array2d/array2d.dart (1 hint)
  • lib/src/array2d/axis.dart (1 hint)

Maintenance suggestions

The package description is too short. (-16 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
meta ^1.1.7 1.1.7
Dev dependencies
test any