Search packages, repositories and app categories

timer_builder cover
Package detailsv2.0.0

timer_builder

A widget that rebuilds itself on scheduled, periodic, or dynamically generated time events.

AndroidiOSWebmacOSWindowsLinux
30-day downloads
14.8K
Likes
168
Pub points
150

Install package

flutter pub add timer_builder

Package Overview

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

TimerBuilder is a Flutter widget that automatically rebuilds its UI in response to time-based events, such as periodic ticks or custom timing schedules. It simplifies the creation of countdown timers, live clocks, and real-time updates without requiring manual state management. The widget supports dynamic timing logic, making it ideal for scenarios where the refresh interval changes during runtime. It works across all major platforms including Android, iOS, Web, macOS, Windows, and Linux.

Use cases

  • Real-time clock displays
  • Countdown timers
  • Dynamic refresh intervals
  • Live data updates
  • Animated countdowns
  • Periodic UI refreshes

Key features

  • Rebuilds on time events
  • Supports dynamic timing
  • Cross-platform compatibility
  • Minimal boilerplate
  • Simple API
  • No need for Timer objects

Suitable for

  • Developers building timers
  • Apps needing live updates
  • UIs with time-dependent content
  • Simple countdown implementations
  • Projects avoiding manual timer management

Considerations

  • Not suitable for high-frequency updates
  • Requires careful handling of dispose
  • May cause performance issues if misused
  • Limited to time-based triggers
  • Does not support complex scheduling

Original README

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

TimerBuilder

A widget that rebuilds itself on scheduled, periodic, or dynamically generated time events.

Here are some use cases for this widget:

  • When showing time since or until a specified event;
  • When the model updates frequently but you want to limit UI update frequency;
  • When showing current date or time;
  • When the representation a widget depends on a certain time event.

animated image

Examples

Periodic rebuild
import 'package:timer_builder/timer_builder.dart';

class ClockWidget extends StatelessWidget {

  @override
  Widget build(BuildContext context) {
    return TimerBuilder.periodic(Duration(seconds: 1),
      builder: (context) {
        return Text("${DateTime.now()}");
      }
    );
  }
  
}
Rebuild on a schedule
import 'package:timer_builder/timer_builder.dart';

class StatusIndicator extends StatelessWidget {

  final DateTime startTime;
  final DateTime endTime;
  
  StatusIndicator(this.startTime, this.endTime);
  
  @override
  Widget build(BuildContext context) {
    return TimerBuilder.scheduled([startTime, endTime],
      builder: (context) {
        final now = DateTime.now();
        final started = now.compareTo(startTime) >= 0;
        final ended = now.compareTo(endTime) >= 0;
        return Text(started ? ended ? "Ended": "Started": "Not Started");
      }
    );
  }
  
}

Categories

Source repository

Projects using this package