datetime_loop
1.6.0, released a year ago by tkantira.com
Flutter widget that listens to system datetime and triggers rebuilds based on specified time units.
What it does
Provides a DateTimeLoopBuilder widget and DateTimeLoopController to listen to the system's datetime and trigger UI rebuilds or stream emissions based on a specified time unit (such as seconds or minutes). It includes features for pausing, resuming, and mocking time via a getNow parameter.
AI-written summary of version 1.6.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to build a live clock widget or timer display that updates every second or minute.
- You want to periodically rebuild UI elements based on system time updates.
- You need to mock system datetime for testing time-dependent UI behavior.
Skip it when
- You require high-precision sub-millisecond stopwatch animations where Flutter's standard AnimationController is more appropriate.
- You are handling background task scheduling rather than UI periodic updates.
Strengths
- Supports multiple time units (milliseconds, seconds, minutes, hours, days).
- Includes a controller to pause and resume updates to save resources.
- Provides a getNow parameter for straightforward unit testing and time simulation.
Weaknesses
- Limited to triggering UI rebuilds based on time intervals rather than complex state management.
- Rebuilding widget trees periodically can impact performance if overused.
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 0
DateTimeLoopBuilder(
timeUnit: TimeUnit.seconds,
builder: (context, dateTime, child) {
return Text('$dateTime');
},
)Alternatives
Packages that do the same job and could replace datetime_loop.
- awesome_datetime_picker
Customizable iOS‑style wheel pickers for dates, times, ranges and durations in Flutter.
64Compare - flutter_countdown_timer
A simple flutter countdown timer widget with support for controllers and custom builders.
50Compare - flutter_rating
A customizable star rating widget for Flutter.
50Compare - otp_timer_button
A Flutter button widget with an integrated timer for resending OTP codes.
43Compare