A lightweight Flutter widget that smoothly animates numeric text whenever the value changes.
Supports integers, decimals, currency symbols, percentages, custom curves, configurable precision, and safe string parsing.
Run this command:
With Flutter:
flutter pub add animated_count_textThis will add a line like this to your package's pubspec.yaml:
dependencies:
animated_count_text: ^latest_versionAlternatively, you can manually add it to your pubspec.yaml and run:
flutter pub getNow in your Dart code, you can use:
import 'package:animated_count_text/animated_count_text.dart';AnimatedCount(
value: 30,
)AnimatedCount(
value: 2500,
prefix: "₹ ",
duration: Duration(milliseconds: 800),
)AnimatedCount(
value: 12.3456,
fractionDigits: 2,
)AnimatedCount(
value: 87.5,
suffix: "%",
fractionDigits: 1,
)The package also includes a helpful string extension for safely converting strings to numbers without crashes.
final intValue = "1200".toInt(); // 1200
final doubleValue = "45.75".toDouble(); // 45.75
final invalid = "abc".toInt(); // 0Perfect for dynamic animations where input may come from APIs or text fields.
| Property | Type | Description |
|---|---|---|
value |
num |
The number to animate to |
fractionDigits |
int |
Decimal precision (default: 0) |
prefix |
String? |
Text before the number |
suffix |
String? |
Text after the number |
duration |
Duration |
Animation duration |
curve |
Curve |
Animation curve |
style |
TextStyle? |
Text styling |
textAlign |
TextAlign? |
Text alignment |
Read the full guide and implementation details on Medium:
This keeps design consistent with your top badges.
