Quiver is a set of utility libraries for Dart that makes using many Dart libraries easier and more convenient, or adds additional functionality.
API Docs are available.
Add Quiver to your project's pubspec.yaml file and run
We recommend the following version constraint:
dependencies: quiver: '>=0.21.0<0.22.0'
Utilities for working with Futures, Streams and async computations.
collect collects the completion events of an
Futures into a
Stream versions of the same-named
forEachAsync perform async computations on
the elements of on Iterables, waiting for the computation to complete before
processing the next element.
StreamBuffer allows for the orderly reading of elements from a stream, such
as a socket.
FutureGroup is collection of Futures that signals when all its child futures
have completed. Allows adding new Futures as long as it hasn't completed yet.
Useful when async tasks can spwn new async tasks and you need to wait for all of
them to complete.
FutureStream turns a
Future<Stream> into a
Stream which emits the same
events as the stream returned from the future.
StreamRouter splits a Stream into mulltiple streams based on a set of
CountdownTimer is a simple countdown timer that fires events in regular
CreateTimerPeriodic are typedefs that are useful for
passing Timer factories to classes and functions, increasing the testability of
code that depends on Timer.
Metronome is a self-correcting alternative to
Timer.periodic. It provides
a simple, tracking periodic stream of
DateTime events with optional anchor
Cache is a semi-persistent, asynchronously accessed, mapping of keys to
values. Caches are similar to Maps, except that the cache implementation might
store values in a remote system, so all operations are asynchronous, and caches
might have eviction policies.
MapCache is a Cache implementation backed by a Map.
ArgumentError if the specifed argument check expression
RangeError if the specified index is out of bounds.
ArgumentError if the specified argument is null.
StateError if the specifed state check expression is
setsEqual check collections for equality.
LruMap is a map that removes the least recently used item when a threshold
length is exceeded.
Multimap is an associative collection that maps keys to collections of
BiMap is a bidirectional map and provides an inverse view, allowing
lookup of key by value.
TreeSet is a balanced binary tree that offers a bidirectional iterator,
the ability to iterate from an arbitrary anchor, and 'nearest' search.
Optional is a way to represent optional values without allowing
firstNonNull returns its first non-null argument.
hash4 generate high-quality hashCodes for
a list of objects, or 2, 3, or 4 arguments respectively.
visitDirectory is a recursive directory lister that conditionally recurses
into sub-directories based on the result of a handler function.
zip create, transform, or combine Iterables in different ways, similar to
extent retreive the minimum and maximum elements from an
GeneratingIterable is an easy way to create lazy iterables that produce
elements by calling a function. A common use-case is to traverse properties in
an object graph, like the parent relationship in a tree.
InfiniteIterable is a base class for Iterables that throws on operations that
require a finite length.
getTypeName returns the name of a Type instance.
classImplements determine if an instance or ClassMirror,
respectively, implement the interface represented by a Type instance. They
implement the behavior of
is for mirrors, except for generics.
getMemberMirror searches though a ClassMirror and its class hierarchy for
a member. This makes up for the fact that
contain members from interfaces or superclasses.
Method wraps an InstanceMirror and Symbol to create a callable that invokes
a method on the instance. It in effect closurizes a method reflectively.
pattern.dart container utilities for work with
Glob implements glob patterns that are commonly used with filesystem paths.
matchesAny combines multiple Patterns into one, and allows for exclusions.
matchesFull returns true if a Pattern matches an entire String.
escapeRegex escapes special regex characters in a String so that it can be
used as a literal match inside of a RegExp.
isBlank checks if a string is
null, empty or made of whitespace characters.
isEmpty checks if a string is
null or empty.
equalsIgnoreCase checks if two strings are equal, ignoring case.
compareIgnoreCase compares two strings, ignoring case.
flip flips the order of characters in a string.
null to empty string, and returns non-empty strings
emptyToNull turns empty string to
null, and returns non-empty strings
repeat concatenates a string to itself a given number of times.
loop allows you to loop through characters in a string starting and ending at
arbitrary indices. Out of bounds indices allow you to wrap around the string,
supporting a number of use-cases, including:
loop('lohel', -3, 2) => 'hello'
repeat, but with better character-level control, e.g.:
loop('la ', 0, 8) => 'la la la' // no tailing space
loop('/path/to/some/file.txt', -3) => 'txt'
loop('top', 3, 0) => 'pot'
Clock provides points in time relative to the current point in time, for
example: now, 2 days ago, 4 weeks from now, etc. For tesability, use Clock
rather than other ways of accessing time, like
new DateTime(), so that you
can use a fake time function in your tests to control time.
Now is a typedef for functions that return the current time in microseconds,
since Clock deals in DateTime which only have millisecond accuracy.
aWeek are unit duration constants to allow writing for example:
const Duration(days: 1)
aSecond * 30vs.
const Duration(seconds: 30)
The Quiver testing libraries are intended to be used in testing code, not production code. It currently consists of fake implementations of some Quiver interfaces.
FakeAsync enables testing of units which depend upon timers and microtasks.
It supports fake advancements of time and the microtask queue, which cause fake
timers and microtasks to be processed. A
Clock is provided from which to read
the current fake time. Faking synchronous or blocking time advancement is also
areEqualityGroups is a matcher that supports testing
assertCheckedMode asserts the current runtime has checked mode enabled.
FakeStopwatch is a Stopwatch that uses a provided
now() function to get the
asynclibraries have been merged into one
Iterableand its methods are generic (using temporary syntax)
fake_async.darttimers are now active while executing the callback
Iterables returned by Multimap.
Glob.allMatches()to match superclass method signature.
matchesAny()to match superclass method signature.
trimRightwill be removed in 0.22.0.
unittestwith finer-grained dependency on
pathis now a dev dependency.
toMap()is deprecated and replaced with
toMap()will be removed in v0.22.0.
areEqualityGroupsmatcher for testing
toString()on returned collections.
Add this to your package's pubspec.yaml file:
dependencies: quiver: "^0.22.0"
You can install packages from the command line:
$ pub get
Alternatively, your editor might support
Check the docs for your editor to learn more.
Now in your Dart code, you can use:
import 'package:quiver/async.dart'; import 'package:quiver/cache.dart'; import 'package:quiver/check.dart'; import 'package:quiver/collection.dart'; import 'package:quiver/core.dart'; import 'package:quiver/io.dart'; import 'package:quiver/iterables.dart'; import 'package:quiver/mirrors.dart'; import 'package:quiver/pattern.dart'; import 'package:quiver/strings.dart'; import 'package:quiver/time.dart';
|0.29.0+1||Mar 29, 2018|
|0.29.0||Mar 29, 2018|
|0.28.2||Mar 24, 2018|
|0.28.1||Mar 22, 2018|
|0.28.0||Jan 20, 2018|
|0.27.0||Jan 3, 2018|
|0.26.2||Nov 16, 2017|
|0.26.1||Nov 16, 2017|
|0.26.0||Nov 1, 2017|
|0.25.0||Mar 28, 2017|
This package version is not analyzed, because it is more than two years old. Check the latest stable version for its analysis.