DEV Community

Baransel
Baransel

Posted on

"youtube_video_info" flutter package

pub.dev/youtube_video_info

github.com/kaex/youtube_video_info

This is a lightweight⚡ package to fetch video info for YouTube from the url

To install, add to pubspec.yaml

flutter:
  sdk: flutter
youtube_video_info: ^1.0.0
Enter fullscreen mode Exit fullscreen mode

and then run flutter pub get

Import the library

import 'package:youtube_video_info/youtube.dart';
Enter fullscreen mode Exit fullscreen mode

Calling the method

YoutubeDataModel videoData = await YoutubeData.getData(link);
Enter fullscreen mode Exit fullscreen mode

Example

var title = videoData.title; // "Ed Sheeran - Bad Habits [Official Video]"
var averageRating = videoData.averageRating; // 4.13242
var durationSeconds = videoData.durationSeconds; // 167
Enter fullscreen mode Exit fullscreen mode

example gif

Top comments (0)