bot 0.28.0

  • Readme
  • Changelog
  • Installing
  • 13


The Dart Bag-of-Tricks #

A collection of (mostly) general libraries to make working with Dart more productive. #

Starting by porting bits of the PL javascript library and Google's Closure javascript library to enable some interesting scenarios.

Projects using BOT #

  • chrome.dart - Dart interop with chrome.* APIs for Chrome Packaged Apps
  • Pop, Pop, Win! - Minesweeper with balloons
  • qr.dart - Generate QR codes
  • vote.dart - Simulate, run, and calculate elections with different election methods
  • Dart Widgets - Reusable Web Components

Try It Now #

The Dart Bag-of-Tricks ( BOT ) is hosted on Add the BOT package to your pubspec.yaml file, selecting a version range that works with your version of the SDK. Always check the BOT page on pub to find the latest release.

See the changelog to find the version that works best for you.

If you'd like to track bleeding edge developments, you can reference the the GitHub repository directly:


Versioning #

  • We follow Semantic Versioning.
  • We are not planning a V1 for BOT until Dart releases V1.
    • In the mean time, the version will remain 0.Y.Z.
    • Changes to the minor version - Y - will indicate breaking changes.
    • Changes to the patch version - Z - indicate non-breaking changes.

Dart SDK dependency #

  • We're going to try to keep BOT in line with the latest integration build of the Dart SDK and Editor.
  • At this point, each SDK release tends to introduce breaking changes, which usually require breaking changes in BOT.
  • Keep an eye on the changelog to see how BOT aligns with each SDK release.

The libraries #

bot -- default library #

  • No dependencies on 3rd-party libraries.
  • Usable for browser-based projects and non-browser projects.

attached #

  • A general model for supporting extensible, runtime-defined events and properties on supported objects.
  • This functionality is inspired by the Dependency Object/Property model in WPF/Silverlight.

collection #

  • Array2d
  • Grouping of collections
  • ReadOnlyCollection

color #

  • RgbColor, HslColor with associated conversions back and forth
  • RgbColor supports to/from hex

events #

  • Easily raise and subscribe to events with custom, type-safe event objects.

math #

  • Mostly classes related to 2D geometry and graphicsgeometry-related classes
  • Coordinate, Box, Size, Vector, AffineTransfrom

bot_async #

  • FutureValue: an abstract model for async conversions via Future<T>
  • SendPortValue: an implementation of FutureValue using isolates.

Authors #

0.28.0 #

  • Removal of a lot of deprecated members.

0.27.0+2 #

  • Updated hop and added hop_unittest dev dependencies.

0.27.0+1 #

  • Updated test dependencies.

0.27.0 #

  • Array2d no longer depends on deprecated types.
  • AffineTransform no longer depends on deprecated tyes.
  • The attached library is now deprecated.
  • Enumerable.toReadOnlyCollection is now deprecated.
  • Box is now deprecated.

0.26.2 #

    • Cloneable
    • Disposable and related classes.
    • EventHandler and related classes.
    • The @protected annotation.
    • Sequence and ReadOnlyCollection
  • Moved library code into many mini-libraries.

0.26.1 2014-03-17 #

  • Dependency tweaks.
  • Fixed subclass issues with Box and Rectangle super class.
  • Test cleanup.

0.26.0 2013-12-09 (SDK r30821) #

  • BREAKING Removed deprecated functions in math: Vector.length and Coordinate.getDistance.
  • DEPRECATED TarjanCycleDetect class. Use top-level stronglyConnectedComponents instead.
  • NEW! Top-level methods
    • topologicalSort: great for figuring out dependencies.
    • streamForEachAsync: great for running a Future for each item in a Stream and pausing while the Future executes.
    • expandStream: Like Stream.expand but allows one to yield a sub-Stream for each item in the source.
  • Miscellaneous
    • Broke a few pieces of bot into sub-libraries.
    • Broke tests into seperate libraries.

0.25.3 2013-11-24 (SDK r30338) #

  • NEW! Added refresh to ThrottledStream

0.25.2 2013-11-24 (SDK r30188) #

  • DEPRECATED Removed bot_async. Everything is just in bot now.
  • NEW! Added ThrottledStream which basically replaces code removed for v0.25.0

0.25.1 2013-11-08 (SDK 0.8.10+10_r30107) #

  • Tiny additions for bot_web

0.25.0 2013-11-07 (SDK 0.8.10+6 r30036) #

  • Lastest SDK
  • Aligned with Dart V1 Pubspec Recommendations.
  • BREAKING Removed most of dart_async. Recent changes to dart:isolate make this code unusable. Will need a major refactoring.

0.24.0 2013-10-09 (SDK 0.8.1+2 r28355) #

  • Latest SDK
  • BREAKING Box, Vector, and Coordinate now align with the new Rectangle and Point classes in dart:math
    • Box.contains is now inherited from Rectangle and expects a Rectangle. Use Box.containsPoint instead.

0.23.1 2013-09-24 (SDK r27776) #

  • Latest SDK
  • Tiny tweaks and cleanup to bot_async

0.23.0 2013-07-24 (SDK r25388) #

0.22.2 2013-07-18 (SDK r25017) #

  • Updated SDK to 0.6.5
  • Moved from pathos to path and moved to a dev dependency

0.22.1 2013-07-11 (SDK r24898) #

  • Fixes for 0.6 SDK rev.
  • Error constructors
  • Warnings on hashCode with ==

0.22.0 2013-06-20 (SDK r24216) #

0.21.0 2013-06-04 (SDK r23552) #

bot #

  • BREAKING EventHandle no longer extends StreamController
    • Should not affect most usage, though.

0.20.1 2013-04-29 (SDK r22072) #

  • Just some tiny nits.

0.20.0 2013-04-17 (SDK 0.4.7+3 r21604) #

  • Removal of a lot of deprecated members.
  • The big library split up. Libraries have been moved into seperate packages.

0.16.3+1 2013-04-09 (SDK 0.4.5+1 r21094) #

0.16.2 2013-04-03 (SDK 0.4.4+4 r20810) #

bot #

  • Sequence learned itemsEqual
  • StringLineReader learned bool get eof and String peekNextLine()

0.16.1 2013-03-25 (SDK 0.4.3+1 r20444) #

0.16.0 2013-03-19 (SDK r20193) #

bot #

  • BREAKING Removed a number of deprecated APIs from Enumerable.
  • BREAKING Replaced ListBase with Sequence. Sequence does not implement List, but it does have an get indexer [int index].

hop_tasks #

  • The unit test task logs a few more things.

0.15.0+2 2013-03-12 (SDK r19425) #

hop_tasks #

  • Fixed dart2js and dart_analyzer task on Windows

0.15.0+1 2013-03-11 (SDK r19425) #

hop_tasks #

  • Fixed dartdoc task on Windows

0.15.0 2013-03-06 (SDK r19425) #

bot #

  • Many changes related to using Stream for events
    • AttachedEvent
      • BREAKING addHandler -> getStream
      • Learned bool hasSubscribers
    • EventHandle
      • Now extends StreamController from dart:async
      • BREAKING removed fireEvent, add, remove
    • BREAKING EventRoot removed.
    • BREAKING GlobalId removed.
    • Property
      • BREAKING addhandler -> getStream
      • BREAKING removeHandler removed
      • BREAKING Change events are now of NEW! type PropertyChangedEventArgs

bot_async #

  • FutureValue
    • BREAKING outputChanged, inputChanged, error are all now Stream

bot_html #

  • Dragger
    • BREAKING dragStart and dragDelta are now Stream
  • ResourceLoader
    • BREAKING progress and loaded are now Stream

bot_io #

  • AnsiColor

    • NEW! Supports bold text
    • NEW! BOLD and RESET consts
    • NEW! instance.asBold() method
  • Console

    • NEW! static bool get supportsColor: An initial attempt to let console apps know if the host console supports color output via a call to String format(bool useColor)
  • NEW! ShellString

    • A String-like value that stores a value and an AnsiColor.
    • Allows centralized creation of text to be sent to the shell with the option to output with our without ANSI escape codes.

bot_retained #

  • MouseManager
    • expose cursorProperty
    • BREAKING All events are now Stream-based
    • BREAKING cursor logic no longer sets the cursor style on the target CanvasElement.
  • BREAKING Thing, ThingParent and Stage invalidated now Stream

bot_texture #

  • TextureAnimationRequest.started is now Stream

hop #

  • BREAKING getHelpTask has been removed. Now a config option on runHop
  • RootTaskContext
    • BREAKING constructor now has a mandatory argument Printer
    • BREAKING log changed signature to take an Object instead of String. color argument removed.
    • BREAKING printCore removed
  • BREAKING Runner is now completely static. All state is stored and passed in via new HopConfig class.
  • TaskLogger learned finest, finer, and config log levels.
  • BREAKING HopConfig was renamed TaskRegistry. A lot of members were hidden.

hop_tasks #

  • dartdoc
    • NEW! createDartDocTask method that returns a Task. Supports postBuild option. Smart defaults.
    • DEPRECATED getCompileDocsFunc and compileDocs

0.14.2 - 25 Feb 2013 (SDK r18915) #

  • Changes Since v0.14.1
  • Bumped minimum Dart SDK version to r18915
  • Updated core dart packages to >= 0.4.0+0

hop #

  • Renamed BaseConfig to HopConfig. BaseConfig is new deprecated.
  • HopConfig learned doPrint. Unifying all printing within hop to allow better redirection.

hop_tasks #

  • The unit test task logic has a new, cleaner Configuration class.

0.14.1 - 23 Feb 2013 (SDK r18717) #

bot #

  • Added requiresArgumentContainsPattern, which deprecates requiresArgumentMatches.

hop #

  • Support task names that contain (but don't start with) '-'

hop_tasks #

  • bench - Output all final results as Duration. Include Standard Error.
  • dart2js - Added createDart2JsTask method.

Shell Completion Script #

  • added symlink bin/shell-completion-generator that points to bin/shell_completion_generator.dart
  • Removed export of COMP_WORDBREAKS in completion script. No need to mess with these values.
  • Generates script for multiple command names

0.14.0 - 20 Feb 2013 (SDK r18717) #

  • Changes Since v0.13.1
  • Bumped minimum Dart SDK version to r18717
  • Updated core dart packages to >= 0.3.7+6
  • Removed vendor/dart.js. Using version from browser package
  • Moved examples into library-specific directories.
  • NEW! bin/shell_completion_generator.dart for creating shell completion scripts compatible with completion logic in bot_io

bot #

  • Enumerable learned expand and deprecated selectMany. Better alignment with Iterable
  • NEW! requireArgumentMatches - match an argument against a Pattern (String or RegExp)

bot_async #

  • NEW! getDelayedResult. See the docs. It's fun.

bot_git #

  • NEW! requireArgumentValidSha1 - lot's of SHA1 hashes flying around. Nice helper.
  • NEW! Tag class. Represents info in a Git tag object.
  • GitDir
    • NEW! getCommits, getTags, showRef, showOrUpdateBranch, commitTree

bot_html #

  • DEPRECATED and fixed getTimeoutFuture

bot_io #

  • NEW! enableScriptLogListener - an easy way to write all log output to disk.
  • NEW! A whole set of new features around shell command completion.
    • See example in example/bot_io/completion/

hop #

  • BREAKING Renamed all completion scripts to extension .sh. Breaks folks who may be sourcing tool/hop-completion.bash
  • Task
    • BREAKING description argument to Task constructors is now named (not positional)
    • NEW! Easy to wire up ArgParser to allow completion of task flags.
    • NEW! Can provide List<TaskArgument> extendedArgs to fully document command line usage.
  • BREAKING! ConsoleContext ctor now takes ArgResults and a Task.
  • DEPRECATED TaskFailError. Use instead
  • NEW! Added getHelpTask() which allows hop help <command name>
  • Updated bin/hop shell script to pass quoted params fully and accurately to hop_runner.dart
  • Exposed Runner.runTask.
  • RunResult now has a descriptive toString
  • Moved core hop command completion logic to new bot_io completion helpers.

hop_tasks #

  • All - using new Task features to document flags and arguments
  • dartdoc Task - added optional excludeLibs and linkApi flags.
  • Git Tasks - added getBranchForDirTask method
  • Unit test Tasks - added --list flag to show all filtered tests, without running them.

0.13.1 - 9 Feb 2013 (SDK r18300) #

  • Cleaned up all deprecations.
  • NO Breaking changes. Should still work great with SDK r18115.

bot #

  • Removed references to dart:collection-dev

hop_tasks #

  • createDart2JsTask arg liveTypeAnalysis defaults to true - matches `dart2js' impl change

0.13.0 - 8 Feb 2013 (SDK r18115) #

bot #

  • CollectionUtil: toHashMap and toHashSet deprecated.
  • CollectionUtil: added toMap
  • BREAKING Enumerable now uses join from Iterable so the default separator is now empty string instead of ,
  • Enumerable: toHashMap and toHashSet deprecated.
  • Enumerable: added toMap
  • NEW! StringLineReader - Lazily read lines from a String. Supports Windows line breaks, too.
  • BREAKING Util.splitLines returns Iterable<String> instead of List<String>
  • Util learned padLeft

bot_git #

  • Commit parses out a lot more information now.
  • Git.runGit argument processWorkingDir is converted to a native path. Works on Windows now.
  • BREAKING GitDir can only be created via "safe", async methods: init and NEW! fromExisting
  • NEW! GitDir learned populateBranch

bot_test #

  • Added Matcher finishes and finishesWith. These correspond to completes and completion in dart:matcher except instances of ExpectException are thrown directly without being wrapped

hop #

  • NEW! ConsoleContext makes it easy to run hop tasks directly from a console app.
  • BREAKING many log methods had their args switched around so LogLevel comes before message. More consistent with logging

hop_tasks #

  • compileDocs now uses new fancy GitDir.populateBranch.

0.12.1 - 5 Feb 2013 (SDK r18115) #

bot_html #

  • getImmediateFuture added

hop #

  • Fixed hop-completion.bash when hop is run outside of a "hop" directory

hop_tasks #

  • NEW! createBenchTask added

0.12.0 - 5 Feb 2013 (SDK r18115) #

  • Now testing harness_browser.html via DumpRenderTree

bot_git #

  • GitDir learned getCurrentBranch

hop #

  • BREAKING ctor for Runner now takes param of ArgResults
  • Runner exposes helpers for parsing defaults args and getting usage.
  • runHopcore prints out nice error info and exits cleanly with bad default args
  • NEW! added TaskContext.getSubLogger

hop_tasks #

  • compileDocs provides useful error info if used with bad args
  • NEW! createDartAnalyzerTask - thanks, Adam!
  • Exposed pipeProcess method for logging Process output in real time

0.11.4 - 31 Jan 2013 (SDK r17657) #

bot_git #

  • A lot of updates and additions
  • NEW! CommitReference, BranchReference, Commit, TreeEntry
  • NEW! GitDir learned getCommitCount, getBranchNames, getBranchReferences, getCommit, lsTree
  • BREAKING GitDir.writeObject renamed to writeObjects

hop_tasks #

  • branchForDir added an optional workingDir argument

0.11.3 - 29 Jan 2013 (SDK r17657) #

  • Bumped logging dependency to >=v0.3.2

bot #

  • More tests for colors. Tiny tweak to improve error report for bad ctor values in HslColor
  • Better exceptions when DetailedArgumentError is used incorrectly
  • requireArgument uses DetailedArgumentError correctly

0.11.2 - 28 Jan 2013 (SDK r17657) #

  • A number of changes to support SDK Although no breaking changes directly affecting users.

hop #

  • Cleanly handle the case where an async task throws an exception before returning a future.

0.11.1 - 24 Jan 2013 (SDK r17463) #

hop #

  • NEW! Extra arguments after the task name are passed to the Task via an arguments property on TaskContext

hop_tasks #

  • createUnitTestTask now uses extra arguments to filter the set of tests that are run

0.11.0 - 22 Jan 2013 (SDK r17328) #

No features were knowingly added, removed, or changed but a lot of code was churned to support the updated SDK.

0.10.0 - 09 Jan 2013 (SDK r16761) #

  • BREAKING Import file names have been updated to include the bot_ prefix.
    • import 'package:bot/bot_retained.dart'; instead of import 'package:bot/retained.dart';

bot #

  • BREAKING Vector.getAngle reports a valid value
  • Array2d can now be zero width, and non-zero height

bot_html #

  • NEW! getTimeoutFuture helper. Wraps window.setTimeout with nice Future semantics.

bot_io #

  • NEW! TempDir
  • NEW! IoHelper

bot_retained #

  • MouseManager
    • BREAKING Renamed from ClickManager
    • Learned how to set cursor for individual Thing instances
    • Learned drag events for Thing instances
  • CanvasThing now correctly invalidates child draw when transform changes

bot_test #

  • NEW! test methods: expectFutureComplete and expectFutureFail
  • NEW! throwsAssertionError matcher

hop #

  • FIX having zero tasks does not cause a exceptions

hop_tasks #

  • BREAKING Renamed createStartProcessTask to createProcessTask
    • Changed the return type to Task
    • Made args argument optional
    • Added optional description argument
  • createDart2JsTask added named params liveTypeAnalysis and rejectDeprecatedFeatures

0.9.0 - 18 Dec 2012 (SDK M2 r16251) #

hop_tasks #

  • BREAKING dartdoc now requires packageDir param. With recent SDK updates, one can now generate docs for libraries that use external packages.
  • dart2js: added optional packageRoot, output, allowUnsafeEval args

0.8.0 - 11 Dec 2012 (SDK r15948) #

BREAKING Moved dependencies on SDK libraries to versions on

bot #

  • NEW Added lerp to top-level math functions.
  • AffineTransform
    • NEW learned a new constructor - fromTranslate
    • NEW learned lerpTx function

bot_retained #

  • BREAKING Massive rename. Element is way to overloaded, hence names like 'PElement'. Going with 'Thing'. Not ideal, but not overloaded.
  • Thing
    • NEW learned alpha -- or at least uses it now
    • BREAKING a tiny change to how dirty state is tracked to allow things to effectively request animation in drawOverride.
    • BREAKING Eliminated 'cacheEnabled' ctor argument.
    • BREAKING Removed clip property. It wasn't doing anything.
  • BREAKING ShapeThing constructor now uses named arguments.
  • NEW NavLayer -- copied from the Javascript library. Pretty fun.
  • NEW HorizontalAlignment and VerticalAlignment
  • NEW RetainedUtil learned getOffsetVector
  • NEW SubCanvasThing -- similar to ImageThing, but for drawing contents of a canvas.
  • NEW TextThing An element to display text. Lot's of work to do, but a good start.
  • NEW StageWrapper - handles requesting frames and drawing them when the stage updates.
  • Added nifty _RetainedEnum as a relatively safe, private subclass for other enum types.

0.7.0 - 27 Nov 2012 (SDK r15355) #

bot #

  • BREAKING Renamed exception classes to align with Dart naming conventions.
  • BREAKING Slight changes to requires methods, DetailedArgumentException

hop #

  • BREAKING Almost everything has changed.
  • Multi-line output is indented correctly.

io #

  • BREAKING io.Color is now io.AnsiColor
  • BREAKING Removed prnt and prntLine. A bit silly, no?

html #

  • CanvasUtil learned setTransform

retained #

  • BREAKING Moved CanvasUtil to bot_html lib

0.6.0 - 19 Nov 2012 (SDK r15042) #

  • BREAKING Merged hop back in. Circular dependencies just make no sense.
  • BREAKING Moved qr into its own repository.
  • A bunch of fixes to support more recent Dart release.

0.5.0 -- 6 Nov 2012 (SDK r14554) #

  • BREAKING Changes to align with Dart r14554.

0.4.0 -- 25 October 2012 (SDK r13851) #

bot #

  • BREAKING Changes to align with new Sequence types

0.3.0 -- 24 October 2012 (SDK r13851) #

  • BREAKING Changes to align with Dart integration build v13851

0.2.1 -- 22 October 2012 (SDK r13679, M1) #

  • Moved hop files into tool dir. These are for devs working with bot.dart not end users.

0.2.0 -- 21 October 2012 (SDK r13679, M1) #

bot #

  • DetailedIllegalArgumentException ctor is now const
  • Removed private _SimpleSet. Not used.

hop - New #

  • An attempt to create a process management system similar to Rake in the Ruby world or Cake in the CoffeeScript world.
  • Moved test, dart2js, and docs to this new system.
  • Naming: A play off frog. Which is a play off dart. As in "dart frog" and "frog hop". Yeah a stretch, but it's short.

retained - Breaking Changes #

  • PElement.draw renamed to _stageDraw
  • PElement.updated event removed
  • Renamed ElementParentImpl to ParentElement
  • Moved logic for handling children from PElement to ParentElement

0.1.0 - 16 October 2012 (SDK r13679) #

  • Aligned with M1 build of Dart r13679

Use this package as a library

1. Depend on it

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

  bot: ^0.28.0

2. Install it

You can install packages from the command line:

with pub:

$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:bot/bot.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.

Analysis issues and suggestions

Support Dart 2 in pubspec.yaml.

The SDK constraint in pubspec.yaml doesn't allow the Dart 2.0.0 release. For information about upgrading it to be Dart 2 compatible, please see


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.0.0 <2.0.0