Member-only story
Flutter Animated Bar Charts
In this article, I will show you how to create an animated bar chart in your Flutter app. Here I used the charts_flutter_new package.
01. Add the charts_flutter package to your dependencies.
update the pubspec.yaml file first.
dependencies:
charts_flutter_new: ^0.12.0
02. Import the charts_flutter package and name ‘charts’
import 'package:charts_flutter_new/flutter.dart' as charts;
03. Create a model class
now it needs to create a model class for the initial setup of the information before plotting the chart. In this example, create a class called subscriberSeries. It will have an int for the amount and a String for subscribers. Also, it includes a bar chart colour.
class NewBooks{
late final String year;
late final int books;
late final charts.Color barColor;
NewBooks({
required this.year,
required this.books,
required this.barColor
});
Now create a new dart file called subscriber.dart, and in this file, we will define the build method of our bar chart.
final List<NewBooks> data…