搜索插件、代码仓与 APP 分类

插件详情v1.1.3

clock

一个可伪造的 dart:core 时钟 API 包装器。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
1540万
喜欢数
258
Pub 分数
140

安装插件

flutter pub add clock

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

时钟包提供了一个可伪造的包装器,用于 Dart 的核心时钟 API,使应用程序中的时间处理更加可预测和可测试。它抽象了系统时间操作,如 DateTime.now() 和 Duration,允许开发人员在测试期间模拟不同的时间点。这对于涉及定时器、计划任务或基于时间的逻辑的单元测试和集成测试尤其有用。该包支持所有主要平台,并可与 Flutter 项目无缝集成。

适合场景

  • 测试时间相关的逻辑
  • 模拟未来或过去日期
  • 在单元测试中模拟系统时间
  • 构建倒计时器
  • 实现延迟操作

主要特点

  • 可伪造的系统时间
  • 测试中行为一致
  • 最小开销
  • 跨平台支持
  • 与现有代码的轻松集成

适合对象

  • 测试驱动开发
  • 时效性应用功能
  • 自动化测试框架
  • 带有计时器的 Flutter 应用
  • 需要确定性时间行为的开发人员

使用建议

  • 不适用于生产环境处理
  • 需要显式使用包装器
  • 可能需要重构依赖时间的代码
  • 仅限基本时间操作
  • 仅在测试环境中使用最佳

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

Overview

This repository is home to tooling related Dart packages. Generally, this means packages published through the tools.dart.dev publisher that don't naturally belong to other topic monorepos (like dart-lang/build, dart-lang/test, or dart-lang/shelf).

Packages

Package Description Issues Version
api_summary Creates an API summary for a package. issues pub package
bazel_worker Protocol and utilities to implement or invoke persistent bazel workers. issues pub package
benchmark_harness The official Dart project benchmark harness. issues pub package
boolean_selector A flexible syntax for boolean expressions, based on a simplified version of Dart's expression syntax. issues pub package
browser_launcher Provides a standardized way to launch web browsers for testing and tools. issues pub package
cli_config A library to take config values from configuration files, CLI arguments, and environment variables. issues pub package
cli_util A library to help in building Dart command-line apps. issues pub package
clock A fakeable wrapper for dart:core clock APIs. issues pub package
code_builder A fluent, builder-based library for generating valid Dart code. issues pub package
coverage Coverage data manipulation and formatting issues pub package
csslib A library for parsing and analyzing CSS (Cascading Style Sheets). issues pub package
extension_discovery A convention and utilities for package extension discovery. issues pub package
file A pluggable, mockable file system abstraction for Dart. issues pub package
file_testing Testing utilities for package:file. issues pub package
glob A library to perform Bash-style file and directory globbing. issues pub package
graphs Graph algorithms that operate on graphs in any representation. issues pub package
html APIs for parsing and manipulating HTML content outside the browser. issues pub package
io Utilities for the Dart VM Runtime including support for ANSI colors, file copying, and standard exit code values. issues pub package
json_rpc_2 Utilities to write a client or server using the JSON-RPC 2.0 spec. issues pub package
markdown A portable Markdown library written in Dart that can parse Markdown into HTML. issues pub package
mime Utilities for handling media (MIME) types, including determining a type from a file extension and file contents. issues pub package
oauth2 A client library for authenticating with a remote service via OAuth2 on behalf of a user, and making authorized HTTP requests with the user's OAuth2 credentials. issues pub package
package_config Support for reading and writing Dart Package Configuration files. issues pub package
pool Manage a finite pool of resources. Useful for controlling concurrent file system or network requests. issues pub package
process A pluggable, mockable process invocation abstraction for Dart. issues pub package
pub_semver Versions and version constraints implementing pub's versioning policy. This is very similar to vanilla semver, with a few corner cases. issues pub package
pubspec_parse Simple package for parsing pubspec.yaml files with a type-safe API and rich error reporting. issues pub package
source_map_stack_trace A package for applying source maps to stack traces. issues pub package
source_maps A library to programmatically manipulate source map files. issues pub package
source_span Provides a standard representation for source code locations and spans. issues pub package
sse Provides client and server functionality for setting up bi-directional communication through Server Sent Events (SSE) and corresponding POST requests. issues pub package
stack_trace A package for manipulating stack traces and printing them readably. issues pub package
stream_channel An abstraction for two-way communication channels based on the Dart Stream class. issues pub package
stream_transform A collection of utilities to transform and manipulate streams. issues pub package
string_scanner A class for parsing strings using a sequence of patterns. issues pub package
term_glyph Useful Unicode glyphs and ASCII substitutes. issues pub package
test_reflective_loader Support for discovering tests and test suites using reflection. issues pub package
timing A simple package for tracking the performance of synchronous and asynchronous actions. issues pub package
unified_analytics A package for logging analytics for all Dart and Flutter related tooling to Google Analytics. issues pub package
watcher A file system watcher. It monitors changes to contents of directories and sends notifications when files have been added, removed, or modified. issues pub package
yaml A parser for YAML, a human-friendly data serialization standard issues pub package
yaml_edit A library for YAML manipulation with comment and whitespace preservation. issues pub package

Publishing automation

For information about our publishing automation and release process, see https://github.com/dart-lang/ecosystem/wiki/Publishing-automation.

For additional information about contributing, see our contributing page.

所属分类

源码仓库

使用此插件的项目

所在榜单