Quiver는 Dart의 핵심 라이브러리에 편리한 확장과 추가 기능을 제공하여 개발자의 생산성을 높이는 유틸리티 라이브러리 모음입니다. 컬렉션 조작, 해싱, 동등성 검사 및 함수형 프로그래밍 패턴과 같은 일반적인 작업을 단순화합니다. 가볍고 모듈식으로 설계되어 Android, iOS, Web, macOS, Windows, Linux 등 여러 플랫폼을 지원합니다. Google에서 유지보수하며 pub를 통해 Flutter 프로젝트에 원활하게 통합됩니다. 재사용 가능하고 잘 테스트된 유틸리티로 코드를 간소화하고 싶은 개발자에게 이상적입니다.
사용 사례
수집 작업 간소화
사용자 정의 동등성 및 해싱 구현
함수형 프로그래밍 향상
불변 데이터 구조 관리
간결하고 가독성 있는 Dart 코드 작성
유틸리티 함수를 통한 테스트 가능성 향상
주요 기능
모듈러 유틸리티 패키지
풍부한 컬렉션 헬퍼
해시 및 동등성 유틸리티
함수형 프로그래밍 도구
크로스 플랫폼 호환성
잘 문서화되고 테스트됨
적합한 대상
코드 간결성을 추구하는 Dart 개발자
강력한 유틸리티 함수가 필요한 프로젝트
일관된 코드 관행을 추구하는 팀
향상된 데이터 처리가 필요한 플러터 앱
불변 또는 복잡한 데이터 유형을 사용하는 개발자
고려 사항
완전한 프레임워크가 아님—유일하게 유틸리티만 추가
일부 패키지는 별도의 가져오기가 필요할 수 있습니다
유용성 향상에 국한되며, UI 구성 요소는 아님
과도하게 사용할 경우 종속성 표면이 증가할 수 있습니다
프로젝트 요구 사항에 따라 선택적으로 사용하는 것이 가장 좋습니다
원본 README
연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.
A set of utility libraries for Dart that makes using many Dart libraries easier
and more convenient, or adds additional functionality.
Utilities for working with Futures, Streams and async computations.
collect collects the completion events of an Iterable of Futures into a
Stream.
enumerate and concat represent Stream versions of the same-named
quiver.iterables methods.
StreamBuffer allows for the orderly reading of elements from a stream, such as
a socket.
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 multiple streams based on a set of
predicates.
CountdownTimer is a simple countdown timer that fires events in regular
increments.
Metronome is a self-correcting alternative to Timer.periodic. It provides a
simple, tracking periodic stream of DateTime events with optional anchor time.
stringFromByteStream constructs a string from a stream of byte lists.
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.
concat, count, cycle, enumerate, merge, partition, range, and
zip create, transform, or combine Iterables in different ways, similar to
Python's itertools.
min, max, and extent retrieve the minimum and maximum elements from an
iterable.
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.
isBlank checks if a string is null, empty or made of whitespace characters.
isNotBlank checks if a string is not null, and not blank.
isEmpty checks if a string is null or empty.
isNotEmpty checks if a string is not null and not empty.
equalsIgnoreCase checks if two strings are equal, ignoring case.
compareIgnoreCase compares two strings, ignoring case.
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:
Rotating: loop('lohel', -3, 2) => 'hello'
Repeating, like String's operator*, but with better character-level
control, e.g.: loop('la ', 0, 8) => 'la la la' // no trailing space
Clock provides points in time relative to the current point in time, for
example: now, 2 days ago, 4 weeks from now, etc. For testability, 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.
aMicrosecond, aMillisecond, aSecond, aMinute, anHour, aDay, and
aWeek are unit duration constants to allow writing for example:
aDay vs. const Duration(days: 1)
aSecond * 30 vs. const Duration(seconds: 30)
Testing Libraries
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
supported.