theory 0.0.4 copy "theory: ^0.0.4" to clipboard
theory: ^0.0.4 copied to clipboard

A collection of some luxury data structures, currently containing OrderedMap, SparsePagination and Queue.

example/main.dart

import 'package:theory/ordered_map.dart';
import 'package:theory/sparse_pagination.dart';

void main() {
  OrderedMap<String, int> map = OrderedMap();
  map.add('a', 1);
  map.add('b', 2);
  map.add('c', 3);
  map.getByKey('c');
  map.getAt(0);
  map.removeAt(0);
  map.removeByKey('c');
  map.updateByKey('b', 14);

  SparsePagination<String> sparsePagination = SparsePagination();
  sparsePagination.add("a", 5);
  sparsePagination.add("b", 10);
  sparsePagination.add("c", 7);

  sparsePagination.getSize(); // 22
  sparsePagination.getPageCount(); // 3
  sparsePagination.getPageIndexInListByKey("b"); // 1
  sparsePagination.getPageSizeByPageIndex(1); //10
  sparsePagination.getGlobalIndexByPageIndex(2); // 15
  sparsePagination.getPageIndexByGlobalIndex(12); // 1
  sparsePagination.getListIndex(1, 3); // 8;
}
1
likes
160
points
87
downloads

Publisher

unverified uploader

Weekly Downloads

A collection of some luxury data structures, currently containing OrderedMap, SparsePagination and Queue.

Homepage

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on theory