Search packages, repositories and app categories

Package detailsv1.0.4

code_timer

Code Execution Timer for Dart and Flutter

AndroidiOSWebmacOSWindowsLinux
30-day downloads
50
Likes
6
Pub points
125

Install package

flutter pub add code_timer

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

Code Timer is a lightweight Dart and Flutter package designed to measure the execution time of code snippets with precision. It provides simple APIs to start, stop, and retrieve elapsed time in milliseconds or seconds, making it ideal for performance testing and debugging. The package supports all major platforms including Android, iOS, Web, macOS, Windows, and Linux, ensuring consistent behavior across environments. Its minimal footprint and straightforward interface make it easy to integrate into any project without overhead.

Use cases

  • Performance benchmarking
  • Debugging slow code paths
  • Measuring function execution time
  • Testing algorithm efficiency
  • Real-time timing in apps

Key features

  • High-precision timing
  • Cross-platform compatibility
  • Simple API
  • Supports multiple time units
  • Lightweight and fast

Suitable for

  • Developers optimizing app performance
  • Testers measuring execution speed
  • Educational projects demonstrating timing
  • Apps requiring real-time feedback
  • Flutter developers needing quick benchmarks

Considerations

  • Not intended for long-running background tasks
  • Timing accuracy may vary slightly on low-end devices
  • Does not support nested timers
  • No built-in logging or reporting
  • Requires manual integration into code flow

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

installation

dart pub add code_timer

usage

  CodeTimer.start();

  // add your code here
  await Future.delayed(const Duration(seconds: 1));

  CodeTimer.stop();

you will see console like this

Execution time: 1004 ms

usage2

CodeTimer.start();

// add your code here
await Future.delayed(const Duration(seconds: 1));

CodeTimer.record(); // optional

// add your code here
await Future.delayed(const Duration(seconds: 1));

CodeTimer.stop();

you will see console like this

Record time: 1004 ms
Execution time: 2007 ms

Categories

Source repository

Projects using this package