web_image_downloader 1.0.1 copy "web_image_downloader: ^1.0.1" to clipboard
web_image_downloader: ^1.0.1 copied to clipboard

Platformweb

Use this package to download / save images to your computer locally, when run in web.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:web_image_downloader/web_image_downloader.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Web Image Downloader example',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Web Image Downloader example'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  final GlobalKey globalKey = GlobalKey();

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            RepaintBoundary(
              key: globalKey,
              child: Image.asset('assets/image.png'),
            ),
            const SizedBox(height: 50),
            IconButton(
              onPressed: () {
                WebImageDownloader.downloadImage(globalKey, 'image1.png');
              },
              icon: const Icon(Icons.download),
            )
          ],
        ),
      ),
    );
  }
}
1
likes
160
pub points
57%
popularity

Publisher

verified publishersivaprasadnk.dev

Use this package to download / save images to your computer locally, when run in web.

Repository (GitHub)
View/report issues

Documentation

API reference

License

Apache-2.0 (license)

Dependencies

flutter

More

Packages that depend on web_image_downloader