sector

Last updated:

0 purchases

sector Image
sector Images
Add to Cart

Description:

sector

Sector #
Fast and intuitive 2D data structures: grids, graphs, pathfinding & more.






Live Demo | Latest API Docs
Getting Started #
Add a dependency in your pubspec.yaml or run the following command:
dart pub add sector
copied to clipboard
Features #

Platform independent, works on the Web, Flutter, and Dart VM.
Idiomatically Dart, with a familiar and fully documented API.
Extensible, with a focus on performance and ergonomics.
Well-tested, with 100% code coverage and property-based tests.
Lightweight, with zero dependencies, minimal overhead, and benchmarked.

Usage #
Sector offers a powerful toolkit for graphs, grids, pathfinding, and more.
Graphs #
Create a graph and add edges:
final graph = Graph<String>();

graph.addEdge(Edge('a', 'b'));
graph.addEdge(Edge('b', 'c'));

print(graph.roots); // ['a']
print(graph.successors('b')); // ['c']
copied to clipboard
Grids #
Create a grid and update cells:
enum Tile {
wall,
floor,
}

// Create a 5x8 grid filled with `Tile.wall`.
//
// When resizing a grid, the `empty` value is used to fill the new cells.
final grid = Grid.filled(5, 8, empty: Tile.wall);

// Itereate over the grid.
for (final row in grid.rows) {
for (final cell in row) {
print(cell);
}
}
copied to clipboard
Pathfinding #
Use built-in pathfinding algorithms or write your own:
final graph = Walkable.linear(['a', 'b', 'c']);

final path = breadthFirstSearch(graph, 'a', Goal.node('c'));
print(path); // Path(['a', 'b', 'c'])
copied to clipboard
Contributing #
To run the tests, run:
dart test
copied to clipboard
To check code coverage locally, run:
dart pub global activate -sgit https://github.com/matanlurey/chore.dart.git --git-ref=8b252e7
copied to clipboard
To preview dartdoc output locally, run:
chore dartdoc
copied to clipboard

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.