How can I animate numbers in flutter?

How can I animate number starting from 0 to the number’s value like the following example :

enter image description here

>Solution :

So there is a Flutter package that helps to do this. You can add it to your pubspec.yaml by using the following command in your terminal :

flutter pub add countup 

and now add this line to your dart code :

import 'package:countup/countup.dart';

and finally add the widget by writing this code :

              begin: 0,
              end: 268000, //here you insert the number or its variable
              duration: Duration(seconds: 3),
              separator: ',', //this is the character you want to add to seperate between every 3 digits
              style: TextStyle(
                fontSize: 36,

Leave a Reply