Adding CanvasJS Charts in Flutter using WebView

Vishwas R
3 min readSep 19, 2023

CanvasJS is a JavaScript charting library that enables developers to create stunning interactive charts for applications. If you’re a Flutter developer looking to integrate CanvasJS charts into your mobile app, you can achieve this by using a WebView.

Prerequisites:

  1. Flutter installed on your system.
  2. A basic understanding of Flutter app development.
  3. CanvasJS library (you can obtain it from the official website).

Step 1: Create a New Flutter Project

If you haven’t already, create a new Flutter project using your preferred development environment or the command line. This will serve as the foundation for your CanvasJS chart integration.

flutter create canvasjs_flutter_app
cd canvasjs_flutter_app

Step 2: Add WebView Flutter Plugin

To utilize WebView in your Flutter project, you need to add the webview_flutter package to your dependencies. Open your pubspec.yaml file and add the following:

dependencies:
flutter:
sdk: flutter
webview_flutter: ^2.0.13 # Use the latest version

Then, run flutter pub get to install the plugin.

Step 3: Create the HTML File with CanvasJS Chart

--

--

Vishwas R

<< Engineer || Software Developer || Techie || Cricketer || Traveler || Blogger >>