flutter_media_downloader 0.0.1 flutter_media_downloader: ^0.0.1 copied to clipboard
This plugin helps user to download medias for example pdf files, image files etc.
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter_media_downloader/flutter_media_downloader.dart';
void main() {
runApp(const MyApp());
WidgetsFlutterBinding.ensureInitialized();
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
final _flutterMediaDownloaderPlugin = MediaDownload();
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
),
body: Center(
child: ElevatedButton(onPressed: () async {
_flutterMediaDownloaderPlugin.downloadPDF(context,'https://www.gstatic.com/webp/gallery3/1.sm.png');
}, child: const Text('Media Download')),
),
),
);
}
}