Video is worth a thousand pictures…

What if the videos on YouTube app, can be viewed on Flutter….Hmmmm


Flutterers, (term coined by me), as we can see are growing,

According to LinkedIn, Flutter, is among the fastest growing skills for software engineers

So, are the packages for the dart….One such package that caught my attention was flutter_youtube

And yes it supports both

  • Android
  • iOS

The app which we demonstrate below is showing seven wonders of the world. It can be broken down into :

  1. Collect Data
  2. Display Data
  3. Integrate YouTube… (below)

Starting with integrating YouTube

Flutter and YouTube…
Flutter and YouTube…


  1. Install the plugin as, 
flutter_youtube: "^1.1.6"

2. Import the package as

import 'package:flutter_youtube/flutter_youtube.dart';

3. Specify your apiKey,

apiKey -> is the google credentials key for your project (GCP project)

You can find your api key under :

GCP key…
GCP key…

4. Use the following to play a video:

apiKey: "YOUR API KEY",
videoUrl: "URL TO PLAY",

Required parameters

apiKey : From step 3

videoUrl : as per your choice

Optional Parameters:

fullScreen: false,

autoPlay: false,

If all went successful, you will see video opening as below screenshot

Flutter and YouTube…
Flutter and YouTube…

Collecting / Retrieving Data…

For the collection of data, we are using Firestore. For retrieval of data, we are using a package called cloud_firestore.

Display Data…

Parent widget is enclosed using a PageView Builder…

If you are not familiar with PageView builder, must-read,

UI can be divided into 2 sections,

  1. Top section (Wonder Image)
  2. Bottom section (Wonder Name and Wonder Location)
Flutter and YouTube…
Flutter and YouTube…

Bottom section, uses the Google Maps for showing the location of the current wonder.

Not familiar with Google Maps in Flutter, must-read

Sample Source code in the link for Google Maps….

For setting the location for the wonder, we are using 

//Latitude of the wonder,
//Longitude of the wonder,

Top section, uses the CachedNetworkImage for requesting the image of the wonder….

CachedNetworkImage(        imageUrl: "YOUR URL",        placeholder: (context, url) => CircularProgressIndicator(),        errorWidget: (context, url, error) => Icon(Icons.error),),

The image widget is then wrapped intoInkWellfor listening to the click/tap events…

and on this tap event, we are eventually calling the YouTube Player…:)

Flutter and YouTube..

Valuable comments