better 0.1.0-dev.5

Dart native js
Flutter Android iOS web

This package serves as an extension to many dart classes with the goal to provide a more fluid development experience

A library for adding many convenience methods / getters as extensions to commonly used dart classes.

#Iterable < int >

BigInt get sum #

  • Calculates the sum of all the elements in the Iterable.
  • Runtime: O(n) where n is the size of the Iterable

###BigInt get product

  • Calculates the product of all the elements in the Iterable.
  • Runtime: O(n*m) where n is the number of elements in the Iterable, and m is the complexity of BigInt's * operation (unknown at the moment)

###IntSummaryStatistics get stats

  • Returns the summary stats for this iterable. Stats include, sum, product, max, min, count, and range
  • Runtime: O(n*m) where n is the number of elements in the Iterable, and m is the complexity of BigInt's * operation (unknown at the moment)
  • This is computed in one pass through the Iterable's elements

Usage #

A simple usage example:

import 'package:better/better.dart';

main() {
  var r = Random();
  var length = r.nextInt(1 << 12);
  print('generating list...');
  var list = [for(int i = 0; i < length; i++) r.nextInt(1 << 31)];
  print('list generated');
  print('calculating stats');
  var start = DateTime.now().millisecondsSinceEpoch;
  var stats = list.stats;
  var end = DateTime.now().millisecondsSinceEpoch;
  print('Finished calculating stats in ${end - start} ms');
  print(stats);
}

Features and bugs #

Please file feature requests and bugs at the issue tracker.

2
likes
100
pub points
19%
popularity

This package serves as an extension to many dart classes with the goal to provide a more fluid development experience

Repository (GitHub)
View/report issues

Documentation

API reference

Uploader

logan.w.russell@gmail.com

License

BSD (LICENSE)

Dependencies

meta, pedantic, test

More

Packages that depend on better